random.choice(seq)

简介: random.choice(seq)
  1. random.choice(seq):从序列中随机选择一个元素
    例子:
import random
fruits = ["apple", "banana", "orange"]
fruit = random.choice(fruits)
print(fruit)


目录
打赏
0
1
1
0
45
分享
相关文章
【随手记】np.random.choice()函数
【随手记】np.random.choice()函数
215 0
【已解决】ValueError: num_samples should be a positive integer value, but got num_samples=0
【已解决】ValueError: num_samples should be a positive integer value, but got num_samples=0
|
10月前
random.random()
random.random()
95 1
|
10月前
random.randint(a, b)
random.randint(a, b)
74 1
|
10月前
|
secrets.choice(seq)
secrets.choice(seq)
48 0
Python random 随机函数(random、uniform、randint、choice、choices、randrange、shuffle、sample)
Python random 随机函数(random、uniform、randint、choice、choices、randrange、shuffle、sample)
172 0
np.random.choice 参数replace
np.random.choice 参数replace
149 0
随机数生成 Random data generation
Spark ml 随机数生成器 RandomRDDs 是一个工具集,用来生成含有随机数的RDD,可以按各种给定的分布模式生成数据集, Random RDDs包下现支持正态分布、泊松分布和均匀分布三种分布方式。 RandomRDDs提供随机double RDDS或vector RDDS。
156 0
Random rand = new Random(47);的简单解释
Random rand = new Random(47);的简单解释
356 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等