www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/04/04:13:19

Date: Wed, 4 Nov 1998 11:12:23 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Pierre MAZIERE <root AT zoltar DOT gatchaman DOT fr>
cc: djgpp AT delorie DOT com
Subject: Re: Random Number
In-Reply-To: <71kbql$a5$1@zoltar.gatchaman.fr>
Message-ID: <Pine.SUN.3.91.981104111205.25255O-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On 2 Nov 1998, Pierre MAZIERE wrote:

> srandom(int seed)  /* what is the meaning of this 'seed' ?*/
> for( ... )
> {
>  i=random();
>  printf("%u \n",i);
>  ...
> 
> };
> 
> Then  things:
> - Every time I launch the executable, the sequence of so called random
>   numbers printed on screen is always the same ( so where is the randomized
>   stuff ?)

I tried to explain all this in section 22.22 of the DJGPP FAQ list.
Please see if the information there is what you need.

> - How can I manage to have 'i' between 0 and MaxRandomNumber ?

This happens by default, if by MaxRandomNumber you mean the constant
RAND_MAX defined on the stdlib.h header file.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019