dimanche 13 septembre 2015

Drawing a random sample from a 2d probability distribution (Python)

I have a 2d probability distribution, 5 x 13 bins, radius bin against period bin, from which I want to draw random numbers while retaining the information on which radius bin and which period bin have been sampled. Is there a way to do this in Python, other than by selecting a random number from 1 to 65, weighted by the probability distribution in a one-row array, and referencing by number (eg number 1 to 13 is radius bin 1, numbers 1, 14, 27, 40 and 53 are period bin 1, so random number 1 is radius bin 1 and period bin 1, for example?).

I look forward to hearing from you.




Aucun commentaire:

Enregistrer un commentaire