Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about random numbers

Author: Sean Empey

Date: 17:11:00 07/26/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?
>
>Thanks in advance
>Antonio

Not sure how random of a number you need. Computers can never truely produce a
random number, but look at the program yarrow. It was written by schneier and
some other fellows for encryption. It can be found on counterpane.com

-Sean



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.