Author: Steven Edwards
Date: 13:51:03 07/22/04
Go up one level in this thread
On July 22, 2004 at 16:45:29, Antonio Senatore wrote: > >Hi friends: > >I need to generate a random number between 0 and 100000. I'm using the following >formula: > >srand((unsigned)(double)time(NULL)); >random_number = (unsigned int) ((double) rand() / (double) RAND_MAX * 100000); > >However, the numbers that I obtain don't seem to be very aleatory that say; >please, could someone tell me what am I doing bad? Don't use srand() or rand(). Use random() and srandom() instead.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.