random.randint() VS np.random.randint()

hi_westlife
• 阅读 379

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])
点赞
收藏
评论区
推荐文章
Easter79 Easter79
2年前
vue+element 表格formatter数据格式化并且插入html标签
前言   vue中element框架,其中表格组件,我既要行内数据格式化,又要插入html标签一贯思维,二者不可兼得也一、element表格数据格式化  !(https://oscimg.oschina.net/oscnet/3c43a1cb3cbdeb5b5ad58acb45a42612b00.p
小恐龙 小恐龙
3年前
彻底搞懂系列B-树、B+树、B-树、B*树
(https://blog.csdn.net/chai471793/article/details/99563704)平衡二叉树概念平衡二叉树是基于二分法的策略提高数据的查找速度的二叉树的数据结构;特点平衡二叉树是采用二分法思维把数据按规则组装成一个树形结构的数据,用这个树形结构的数据减少无关数据的检索,大大
Wesley13 Wesley13
2年前
B树与B+树的区别?
1.B树简介B树是一种多路平衡搜索树。它由二叉树变换而来的。定义如下:1.1每个节点最多有m1个关键字1.2根节点最少有1个关键字1.3非根节点至少有m/2个关键字1.4每个节点的关键字都是按照从小到大的顺序排列,每个关键字的左子树中的关键字都小于它,而右子树中所有关键字都大于它。1.5所有的叶子节点都处于同
Stella981 Stella981
2年前
2020年值得关注的25家美国SaaS初创企业
!(https://oscimg.oschina.net/oscnet/be2863b17cd691dba1931ce1b0fbd1b29a4.jpg)!(https://oscimg.oschina.net/oscnet/96b894c99c1d15aef71e63427faaef43b3a.jpg)导语根据Gartne
Stella981 Stella981
2年前
Jenkins流水线即代码之扩展共享库
!(https://oscimg.oschina.net/oscnet/ab8ee75c43cb1a3fd0fac241648861b03c5.gif)!(https://oscimg.oschina.net/oscnet/1a35fdf03222f188f706711d2b43eae6a14.gif)!(https://osci
Stella981 Stella981
2年前
JS 对象数组Array 根据对象object key的值排序sort,很风骚哦
有个js对象数组varary\{id:1,name:"b"},{id:2,name:"b"}\需求是根据name或者id的值来排序,这里有个风骚的函数函数定义:function keysrt(key,desc) {  return function(a,b){    return desc ? ~~(ak
Wesley13 Wesley13
2年前
B2B或B2C或B2B2C平台如何实现结算功能
问:B2C商城,在对每个商家结算时,必须要直接结算到微信支付宝银行卡,而不能先结算到平台上,之后自行提现吗?据说这是法律限制,是因为没有支付牌照吗?如果是这样的话,那么系统的设计是从微信/..等支付的时候,就是用商家的微信账户,还是在结算时使用统一的账户打入商家账户中?答:的确是因为牌照的关系,因为你做B2C电商,提供服务的是
可莉 可莉
2年前
2020年值得关注的25家美国SaaS初创企业
!(https://oscimg.oschina.net/oscnet/be2863b17cd691dba1931ce1b0fbd1b29a4.jpg)!(https://oscimg.oschina.net/oscnet/96b894c99c1d15aef71e63427faaef43b3a.jpg)导语根据Gartne
Wesley13 Wesley13
2年前
B
BTreeBTree又叫做B树,和平衡二叉树不同的地方在于B树是多叉树(平衡多路查找树),Oracle和MongoDB的索引技术就是基于B树的数据结构,B树也可以看作是对23查找树的一种扩展。一个m阶的BTree有以下性质1.每个节点最多有m个子节点;2.每个非叶子节点(根节点除外)至少含有m/2个子节点;3.
hi_westlife hi_westlife
2年前
random.randint() VS np.random.randint()
random.randint(a,b):a,b,returnONErandomnumberofbetweenaandb,bothaandbareincludedwhenacuqiringthenumber;random.randint(a,b,sizetuple):a,b),returnrandomnumber(s)ofbetweenaandb,aincludedandbisnotwhenacuqiringth
hi_westlife
hi_westlife
Lv1
Heavy is the head who wears the crown
文章
3
粉丝
0
获赞
0