Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.rwth-aachen.de!uni-paderborn.de!golden-gate.owl.de!fu-berlin.de!main.Germany.EU.net!EU.net!newsfeed.internetmci.com!in3.uu.net!world!olorin
From: olorin@world.std.com (Mark J Musante)
Subject: Re: [TADS] (Again?  Oy!) Random # Generation.
Message-ID: <DvBAqw.J9t@world.std.com>
Organization: The World @ Software Tool & Die
X-Newsreader: TIN [version 1.2 PL2]
References: <4tebq4$khe@agate.berkeley.edu> <4tengq$paq@nntp4.u.washington.edu>
Date: Mon, 29 Jul 1996 15:52:08 GMT
Lines: 22

Dan Shiovitz (scythe@u.washington.edu) wrote:
> In article <4tebq4$khe@agate.berkeley.edu>,
> Gerry Kevin Wilson <whizzard@uclink.berkeley.edu> wrote:
> >I have noticed that rand(6)+rand(6)+rand(6) just absolutely will NOT
> >result in either a 3 or 18.
> I've noticed the random number generator is crappy.  I didn't realize it
> was this crappy, though.

I've got a feeling there's something in the generator that prevents it from
returning the same value more than twice in a row.  I haven't checked it out,
though. 

The following function should help a bit:

getrand: function( val )
{
	return ( rand( val * 2 - 1 ) + 1 ) / 2;
}

This will at least allow three numbers in a row.

 - Mark
