不重复采样
c = range(10) N = 30 index1 = random.sample(c, N) index2 = random.sample(c, N) print(index1) print(index2)
可重复采样:
import numpy as np choices = np.random.choice(c, size=30, replace=True) print(choices)

不重复采样
c = range(10) N = 30 index1 = random.sample(c, N) index2 = random.sample(c, N) print(index1) print(index2)
可重复采样:
import numpy as np choices = np.random.choice(c, size=30, replace=True) print(choices)