np.random模块dom
一、rand(d0, d1, ..., dn)spa
Random values in a given shape.orm
Create an array of the given shape and populate it with random samples from a uniform distribution over [0,1).ip
二、randn(d0, d1, ..., dn)ci
Return a sample (or samples) from the “standard normal” distribution.element
三、randint(low[, high, size, dtype])it
Return random integers from low (inclusive) to high (exclusive).io
Return random integers from the “discrete uniform” distribution of the specified dtype in the “half-open” interval [low, high). If high is None (the default), then results are from [0, low).form
四、random_integers(low[, high, size])class
Random integers of type np.int between low and high, inclusive.
五、random_sample([size])
Return random floats in the half-open interval [0.0, 1.0).
Results are from the “continuous uniform” distribution over the stated interval. To sample Unif[a, b), b > a multiply the output of random_sample by (b-a) and add a:
六、random([size])
Return random floats in the half-open interval [0.0, 1.0).
七、ranf([size])
Return random floats in the half-open interval [0.0, 1.0).
八、sample([size])
Return random floats in the half-open interval [0.0, 1.0).
九、choice(a[, size, replace, p])
Generates a random sample from a given 1-D array
十、bytes(length) Return random bytes.
一、np.ones(shape, dtype=None, order=’C’)
Return a new array of given shape and type, filled with ones.
二、np.zeros(shape, dtype=float, order=’C’)
Return a new array of given shape and type, filled with zeros.
三、np.eye(N, M=None, k=0, dtype=<type ‘float’>)
Return a 2-D array with ones on the diagonal and zeros elsewhere.
内置random模块
一、random.gauss(mu, sigma) Gaussian distribution高斯分布
mu-->mean, sigma-->standard deviation
二、random.normavariate(mu, sigma) Nomal distribution正态分布
mu-->mean, sigma-->standard deviation
三、random.shuffle(x, random=None)
shuffle list x in place and return None.原地清洗列表x并返回None
四、random.choice(seq)
Choose a random element from a non-empty sequence.从非空序列中随机选择一个元素。
五、random.randint(a, b)
Return random integer in range [a, b], including both end points.从闭区间[a,b]返回一个随机整数.
六、random.random() 在区间[0, 1)随机生成一个小数
七、random.uniform(a, b)
Get a random number in the range [a, b) or [a, b] depending on rounding.根据数值修约在区间[a, b]返回一个随机数