python numpy.random.choice
时间: 2023-10-23 20:35:33 浏览: 115
numpy.random.choice是一个用于在给定的一维数组中随机选择元素的函数。它的参数包括数组a、输出大小size、是否可重复选取replace和元素的概率分布p。具体来说,它可以从数组a中随机抽取数字,并根据给定的参数生成相应大小的输出数组。replace参数控制是否允许重复选取,p参数可以指定每个元素被选中的概率。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [numpy中np.random.choice()的用法详解及其参考代码](https://blog.csdn.net/woxiangxinwang/article/details/123175674)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [python np.random.choice方法](https://download.csdn.net/download/weixin_38730201/13743853)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文