www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/02/10:20:33

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: random() / randomizer / srandom(...) problems!
Date: Sun, 2 May 1999 07:34:01 -0600
Message-ID: <01be94a0$70ab3820$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

>Where is the problem ???
>The randomizer doesn't work correctly ???



    read the docs.  rand() and random() are only pseudo-random generators.
that means that if you srandom() the same value every time, you'll get the
same set of numbers.  get a different set, try something like
srandom(realclock());

    -={C}=-

- Raw text -


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