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.24 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.