View Single Post
Old 09-23-2003, 06:05 AM   #5 (permalink)
dimbulb
Riiiiight........
 
Well, there are several ways of generating random numbers corresponding to a distribution from uniform[0,1] distributions ( thats what you essentially get when you use rand().)

Another way, if you have a nice function, is to use the inverse of the cumulative distribution function. Since the cumulative distribution function maps from [range of values in the distribution] to [0,1], and thus the inverse maps from [0,1] to [range of values], and the uniform is also from [0,1], you can get generate a random U(0,1) number, and plug it into the inverse of the CDF.

For more information about generating random numbers, check up a book on simulation. The textbook by Law and Kelton has a pretty comprehensive section on how to generate random numbers.
dimbulb is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60