Click to See Complete Forum and Search --> : Random number generators
ejlynch
02-26-2004, 05:28 PM
I want to generate random probabilities between 0 and 1.
Can anyone tell me the difference between using the following functions in C under linux.
1. 1.0 * random() / (RAND_MAX + 1.0)
2. drand48()
Strogian
02-26-2004, 07:11 PM
the first one is retarded, because you're multiplying by 1.0
that's all i know about it
:eek:
mengle
02-26-2004, 07:29 PM
I'm sure you already know this but most randon number generator functions are not actually random (which you can observe by running it thousands of times). So if you need to really generate "truly" random numbers or are going to be doing something with lots of iterations (e.g., Monte Carlo Simulations) you may want to look into something a little more robust.