“random.choice” Code-Antworten

Auswahl zufälliger Python

import random

#sampling with replacement
list = [20, 30, 40, 50 ,60, 70, 80]
sampling = random.choices(list, k=4)
print("Randomly selected multiple choices using random.choices() ", sampling)
Rocku0

random.choice

random.choice(sequence)
Clumsy Cockroach

random.choice

np.random.choice(5, 3, replace=False, p=[0.1, 0, 0.3, 0.6, 0])
array([2, 3, 0]) # random
Easy Echidna

Ähnliche Antworten wie “random.choice”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen