random.sample(population, k)

本文涉及的产品
实时数仓Hologres,5000CU*H 100GB 3个月
智能开放搜索 OpenSearch行业算法版,1GB 20LCU 1个月
实时计算 Flink 版,5000CU*H 3个月
简介: random.sample(population, k)

random.sample(population, k): 从指定序列中随机选择k个元素作为一个新列表返回

import random
numbers = [1, 2, 3, 4, 5]
selected_numbers = random.sample(numbers, 3)
print(selected_numbers)


相关文章
|
10月前
Adjustable Precision Shunt Regulator
一、产品描述 The TL431 is a three-terminal adjustable regulator series with a guaranteed thermal stability over applicable temperature ranges. The output voltage may be set to any value between Vref and 36 volts with two external resistors. These device have a typical dynamic output impedance of 0.27Ω,
|
Linux 定位技术 数据安全/隐私保护
【Calculate】Calculate Linux安装操作记录
【Calculate】Calculate Linux安装操作记录
179 0
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
611 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
|
测试技术
std::accumulate的具体用法
std::accumulate的具体用法
402 0
std::accumulate的具体用法
ValueError: Sample larger than population or is negative
ValueError: Sample larger than population or is negative
212 0
|
Go
HDOJ 1012 u Calculate e
HDOJ 1012 u Calculate e
125 0
HDOJ 1012 u Calculate e
|
算法
HDOJ 1202 The calculation of GPA
HDOJ 1202 The calculation of GPA
140 0
|
数据可视化
Paraview: Calculate Derivatives of 3-D Unstructured Dataset
关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新! Paraview 是一款基于VTK的、开源的、跨平台的科学数据可视化软件,其三维显示和后处理功能非常强大。
2872 0