I have a file with some probabilities for different values e.g.:
1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2
I would like to generate random numb
Maybe it is kind of late. But you can use numpy.random.choice(), passing the p parameter:
p
val = numpy.random.choice(numpy.arange(1, 7), p=[0.1, 0.05, 0.05, 0.2, 0.4, 0.2])