Computer Chess Club Archives


Search

Terms

Messages

Subject: A question about random numbers

Author: Antonio Senatore

Date: 13:45:29 07/22/04



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?

Thanks in advance
Antonio



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.