random.randint() VS np.random.randint() 4年前

random.randint(a, b): [a, b], return ONE random number of between a and b, both a and b are included when acuqiring the number;

random.randint(a, b, size = tuple): [a, b), return random number(s) of between a and b, a included and b is not when acuqiring the number(s), size is 1 by default



e.g.

In [36]: random.randint(1,10)
Out[36]: 8
------------------------------------
In [37]: np.random.randint(10,20)
Out[37]: 11

In [38]: np.random.randint(10,20,2)
Out[38]: array([19, 15])
image
三无控丶desu
醉生梦死才是人生真正追求。
1
发布数
2
关注者
693
累计阅读

热门教程文档

Rust
84小节
Flutter
105小节
Vue
25小节
Dart
35小节
React
18小节
广告