np.random.randint 与 np.random.rand区别 前者返回为参数指定的范围区间的一个整数后者返回的为一个概率
import numpy as np
num_lstm = np.random.randint(175, 275)
print(num_lstm)
print("np.random.rand()=",np.random.rand())
1 numpy.random.
randint
(low, high=None, size=None, dtype='l')¶
Return random integers from low (inclusive) to high (exclusive).
2
numpy.random.
rand
(d0, d1, ..., dn)
Random values in a given shape.
Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1)
.
参考
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.random.rand.html#numpy.random.rand
#result
179 np.random.rand()= 0.46235794173895617