[Prev][Next][Index][Thread]
Re: A85: Probability
On Sun, 15 Mar 1998 10:35:29 -0600, you wrote:
>
>Is there a routine to generate numbers according to probability?
>For example, say I want to generate numbers 1-5, but with 5 having a 50%
>
>chance of being picked, 1 --> 20% chance, 2 -->10% , etc...
>
>Albert Chang
>
>
you could call a random number routine (like jimmy mardell's prandom)
and have it select, say, values 0-9. each one of these has ~
probability of 10%. then map the numbers into different numbers such
as:
random num map to prob.
---------- ------ -----
0 or 1 1 20%
2 2 10%
3,4,5 3 30%
6,7,8,9 4 40%
but as for an actual routine to do this, i would imagine you are on
your own :(.
-mike
mgp4007@omega.uta.edu
References: