delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/03/03:58:48

Date: Mon, 3 Aug 1998 10:58:37 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mark Haase <savar AT mindspring DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Newbie questions...
In-Reply-To: <01bdbe8e$78f07560$b9ba56d1@livivie.pinecrest.edu>
Message-ID: <Pine.SUN.3.91.980803105732.632H-100000@is>
MIME-Version: 1.0

On 3 Aug 1998, Mark Haase wrote:

> Second, how come both rand() and random() generate the same numbers again
> and again.. I can't find any sort of seed function to fix this. Is there
> one or am i using it wrong?

Use `srand' and `srandom', respectively, to seed `rand' and `random'. The 
usual practice is to seed them with the value returned by "time(0)".

- Raw text -


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