当前位置:网站首页>numpy.random.choice
numpy.random.choice
2022-06-26 05:48:00 【Wanderer001】
参考 numpy.random.choice - 云+社区 - 腾讯云
numpy.random.choice(a, size=None, replace=True, p=None)
从a(数组)中选取size(维度)大小的随机数,replace=True表示可重复抽取,p是a中每个数出现的概率。 若a是整数,则a代表的数组是arange(a)。
>>> random.choice(5)
3
>>> random.choice([0.2, 0.4])
0.2
>>> random.choice([0.2, 0.4], p=[1, 0])
0.2
>>> random.choice([0.2, 0.4], p=[0, 1])
0.4
>>> random.choice(5, 5)
array([1, 2, 4, 2, 4])
>>> random.choice(5, 5, False)
array([2, 0, 1, 4, 3])
>>> random.choice(100, (2, 3, 5), False)
array([[[43, 81, 48, 2, 8],
[33, 79, 30, 24, 83],
[ 3, 82, 97, 49, 98]],
[[32, 12, 15, 0, 96],
[19, 61, 6, 42, 60],
[ 7, 93, 20, 18, 58]]])边栏推荐
猜你喜欢
![[activity recommendation] cloud native, industrial Internet, low code, Web3, metauniverse... Which is the architecture hot spot in 2022](/img/64/5b2aec7a26c64c104c86e200f83b2d.png)
[activity recommendation] cloud native, industrial Internet, low code, Web3, metauniverse... Which is the architecture hot spot in 2022

When was the autowiredannotationbeanpostprocessor instantiated?

状态模式,身随心变

kolla-ansible部署openstack yoga版本

Uni app ceiling fixed style

MySQL database-01 database overview
![[arm] add desktop application for buildreoot of rk3568 development board](/img/9a/28015cdea7362261c39ffc7f6e13a9.png)
[arm] add desktop application for buildreoot of rk3568 development board

Combined mode, transparent mode and secure mode

AutowiredAnnotationBeanPostProcessor什么时候被实例化的?

电商借助小程序技术发力寻找增长突破口
随机推荐
Learn cache lines and pseudo sharing of JVM slowly
花生壳内网穿透映射NPM私服问题
Pre-Sale Analysis
Implementation of third-party wechat authorized login for applet
DOM文档
The State Council issued a document to improve the application of identity authentication and electronic seals, and strengthen the construction of Digital Government
There are applications related to web network request API in MATLAB (under update)
Project suspension
Machine learning 07: Interpretation of PCA and its sklearn source code
适配器模式
Life is so fragile
ZigBee learning in simple terms lesson 3 external interruption
423-二叉树(110. 平衡二叉树、257. 二叉树的所有路径、100. 相同的树、404. 左叶子之和)
Lesson 4 serial port and clock
[arm] build boa based embedded web server on nuc977
Prototype mode, Baa Baa
String class learning
SQL Server视图
Given two corresponding point sets AB, how to estimate the parameters of the specified transformation matrix R?
Win socket programming (Mengxin initial battle)