Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python random choices weights

import random

numberList = [111, 222, 333, 444, 555]
print(random.choices(numberList, weights=(10, 20, 30, 40, 50), k=5))
# Output [555, 222, 555, 222, 555]
Source by pynative.com #
 
PREVIOUS NEXT
Tagged: #python #random #choices #weights
ADD COMMENT
Topic
Name
3+8 =