delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/10/21:38:15

Date: Sun, 10 Aug 1997 21:38:32 -0400 (EDT)
From: Jude DaShiell <jdashiel AT eagle1 DOT eaglenet DOT com>
Sender: jdashiel AT eagle1 DOT eaglenet DOT com
To: Peter Steiner <p DOT steiner AT t-online DOT de>
Cc: djgpp AT delorie DOT com
Subject: Re: Newbie Question: Random Numbers
In-Reply-To: <5sckav$i2o$5@news01.btx.dtag.de>
Message-Id: <Pine.NXT.3.95.970810213008.26931A-100000@eagle1>
Mime-Version: 1.0

Although pseudorandom numbers are all that's possible
on a computer the quality of them can be improved
by choice of seeds.  Under struct time,
there's a component that shows milliseconds of time since midnight.
Using that as a seed value repeatedly and randomly likely will
help.  The first number taken off the milliseconds value provided it's
not zero could be used as a loop counter.
The loop is entered.  The random function is
seeded; the rest of the program happens that uses the random number
including number generation, the loop is decremented, the loop starts again.
Actually a nested loop with number of random numbers required needs to
surround the above loop.
That loop is decremented with each random number generated and tested against the
quantity of numbers required.
Therefore, you no longer have one random factor but two factors are in play.
User interaction with the program will provide a third.
hth.
//eoj

jude <jdashiel AT eagle1 DOT eaglenet DOT com>
While anyone can write anything on the internet; noone has the ability nor the right
to compel anyone else to read their writing.

- Raw text -


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