delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/01/16:30:31

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Generating random numbers...
Date: Mon, 01 Jun 1998 15:32:23 +0000
Organization: Southwest Missouri State Universtiy
Lines: 13
Message-ID: <3572C987.D4D69D5D@nic.smsu.edu>
References: <19980527010023 DOT AAI19094 AT ppp114 DOT cartsys DOT com> <35720B76 DOT C80EFBB AT earthlink DOT net DOT nospam>
NNTP-Posting-Host: sara.a30.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryan wrote:

> i know that it is probably incredibly inefficient and bad coding and
> all of that crap, but it seeds the number generator rand() pretty well

Seeding the random number generator a thousand times isn't going to make it any
more random than seeding it once.  The only "gain" you get is knowing that the
generator algorithm will start from a different point.  This isn't going to make
subsequent random number requests any more random.

Using "srand(time(NULL))" is just as effective, but easier to follow.


- Raw text -


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