Answers for "python random probability based on function"

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 probability based on function"

Python Answers by Framework

Browse Popular Code Answers by Language