I was hoping to know if there is a command in numpy of scipy to pick an element of a data from a discrete random distribution. i.e.,
For example I have a discrete distribution x = (0.5, 0.3, 0.2)
and I want to sample from y = (1, 2, 3)
...
>>> sample(x, y)
2
>>> sample(x, y)
3
>>> sample(x, y)
3
>>> sample(x, y)
1
Hope my question is clear. Thanks.