Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Sampling From a Histogram Distribution

by educated_foo (Vicar)
on Jan 06, 2014 at 00:53 UTC ( #1069437=note: print w/ replies, xml ) Need Help??


in reply to Sampling From a Histogram Distribution

Assume you have a uniform random number generator, like Perl's rand. Just scale its output to the range 1..(4+19+10+5), then assign each of your four things a suitably-sized chunk of that range (apples == 1..4, oranges == 5..24, etc.).


Comment on Re: Sampling From a Histogram Distribution

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069437]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2015-07-04 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls