Answers for "python random number with probability"

0

random with probability python

import random

data = [1, 2, 3, 4, 5, 6]
probability = [0.3, 0.3, 0.1, 0.1, 0.1, 0.1]
 
random.choices(data, probability)
Posted by: Guest on May-04-2021

Code answers related to "python random number with probability"

Python Answers by Framework

Browse Popular Code Answers by Language