TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Richard Veto
from: George White
date: 1998-06-25 19:22:00
subject: Random number generation

Hi Richard,

You asked:

RV>Not too long ago, there was a brief discussion on random
RV>numbers.  Unfortunately, they've been purged from this
RV>system.

RV>I was wondering what was the most effective way to generate random numbers.
RV>I've tried:
RV>randomize();
RV>x = random(number);

RV>and the srand method.  However, I find that if I generate
RV>two seperate numbers very quickly, that they are identical.
RV> Furthermore, with the srand method, if I try to get let's
RV>say 10 random numbers, and get another 10 that sometimes
RV>they are identical.

There are two alternative random number generators in SNIPPETS, an
invaluable source archive no serious C (and C++) programmer should be
without (and should give thanks to Bob Stout for maintaining). Use one
of them.

RV>Is there a true way how to get a random number?

The SNIPPETS code is about as close as you'll get programatically.

George

 * SLMR 2.1a * Computers eliminate spare time.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 670/213 218
@PATH: 440/4 255/1 252/356 140/1 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.