Subject Re: [ib-support] how random is rand() ?
Author Ann W. Harrison
At 09:27 PM 9/1/2002 +0000, duilio_fos wrote:

>Am I bad or is the rand() function bad ?

I can't speak for your goodness, but that function
is an embarrassment. It calls the clib srand function,
which works pretty well when used correctly, but rather
than calling srand with a seed then rand, it calls only
srand and always uses the current time as the seed.

If you're storing lots of records, you get lots of
duplicate values from the rand function because the
time returned isn't precise enough.

Even if you don't get duplicates, the values increase
- the result of having a slowly increasing seed...


We have answers.