np.random.choice(a, size=None, replace=True, p=None)
#a为一维数组或者int,size默认None,此时返回一个值,也可以为int或者tuple,replace=True为有放回的选择,可能出现重复,p为概率列表,之和应该为1.
Parameters:
a : 1-D array-like or int
If an ndarray, a random sample is generated from its elements.
If an int, the random sample is generated
【numpy】np.random.choice
最新推荐文章于 2023-11-02 23:35:36 发布