www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/26/15:17:09

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random numbers...
Date: Thu, 25 Sep 1997 13:08:09 +0100
Organization: None
Distribution: world
Message-ID: <WEH3ytApQlK0Ewqe@jenkinsdavid.demon.co.uk>
References: <3 DOT 0 DOT 32 DOT 19701231220000 DOT 00767290 AT mail DOT geocities DOT com>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <3 DOT 0 DOT 32 DOT 19701231220000 DOT 00767290 AT mail DOT geocities DOT com>,
Guilherme Silveira <thedarkage AT mail DOT geocities DOT com> writes
>Random numbers?
>Let me say something...
>
>Why don't you save on a file just an integer and use it for initialize the 
>random algorithm. But there's more one thing. Every time you use this integer, 
>you do the folowing:
>
>integer--;
>
>And save 'integer' back into the file
>
>I think it's a good way for random numbers
>

Why bother??
What if a user deletes the file??

What's wrong with using the timer to seed it??
The chances of running the program at the exact same millisecond you
last ran it are pretty slim. :)

Might be handy if it's a program which runs from the bootup process,
then timer might be the same each time. Timer does start from the moment
the PC boots doesn't it?? But even then you could use the system clock
to seed it. :)

-- 
http://www.jenkinsdavid.demon.co.uk for C programmers.
David Jenkins

- Raw text -


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