Author: Álvaro Begué
Date: 21:15:58 07/22/04
Go up one level in this thread
>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); Make sure that you only call srand() once, at the beginning of the program, and then you call rand() as many times as needed. If you still don't get random enough numbers, post a tiny program that shows the problem, along with the output that you are getting and an explanation of why you consider it unsatisfactory.
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.