Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What's the best random number generator?

11 views
Skip to first unread message

Henry Choy

unread,
Feb 3, 1995, 11:43:06 AM2/3/95
to
I found that the basic rand() in C is not entirely uniformly
distributed, but it's not too bad.

Over all these years, what is the best random number generator?


--
Henry Choy "Math class is hard" - Barbie

e-mail: ch...@cs.usask.ca I AGREE!

Harry Smith

unread,
Feb 3, 1995, 4:29:59 PM2/3/95
to

Try this one:

/* Start of file Random.C */

#include <stdio.h> /* Definitions for stream input/output */
#include <math.h> /* Definitions for the math floating point package */

#define MAXLONG 0x7fffffffL

char *Name = "Random - Test a version of Minimal Standard random number generator";
char *Version= "C Version 1.0, last revised: 1994-09-03, 1600 hours";
char *Author = "Copyright (c) 1981-1994 by author: Harry J. Smith,";
char *Address= "19628 Via Monte Dr., Saratoga, CA 95070. All rights reserved.";

/* Notes: See article "RANDOM NUMBER GENERATORS: GOOD ONES ARE HARD TO FIND"
* by Strphen K. Parks and Keath W. Miller in Communications of the ACM,
* Oct 1988 pg 1192. It defines the Minimal Standard random number generator
* as f(z) = 16807 * z mod 2147483647. 16807 = 7^5, 2147483647 = 2^31 - 1.
* The seed must be between 1 and 2^31 - 2 inclusive. Period is 2^31 - 2.
*/

/* Developed in the C subset of Borland C++ Version 4.0 */

/* Global variables */
long SeedL = 1L;

/* Procedure prototypes */
void init( void); /* Initialize */
void ReadReal( char *Mess, double Min, double Max, double Nom, double *I); /*
Read in a Real from keyboard */
void RandomizI2( void); /* Integer Version 2 */
double RandomI2( void); /* Integer Version 2 */

/* -------------------------------------- */
void init( void) /* Initialize */
{
printf("\r\n%s\r\n%s\r\n%s\r\n%s\r\n", Name, Version, Author, Address);
} /* End of init */

/* -------------------------------------- */
void ReadReal( char *Mess, double Min, double Max, double Nom, double *R) /*
Read in a Real from keyboard */
{
char St[129];
char *ior;
int Stat;

do {
do {
printf("%s", Mess);
printf(" [%.1lf, %.1lf] (ENTER => %.1lf): ", Min, Max, Nom);
ior = gets( St);
} while (ior == NULL);
Stat = sscanf( St, "%lf", R);
} while (!(((Stat == 1) && (*R >= Min) && (*R <= Max)) || (St[0] == 0)));
if (St[0] == 0) *R = Nom;
printf("Input = %.1lf\n\n", *R);
} /* End of ReadReal */

/* -------------------------------------- */
void RandomizI2( void) /* Integer Version 2 */
{
double R;
do {
printf("\nInput a random number seed from 1 thru 2147483646, or 0 to exit\n");
ReadReal("Seed = ", 0, 2147483646L, (double)SeedL, &R);
if (fabs(R) <= MAXLONG)
SeedL = R;
else
SeedL = -1;
} while ((SeedL < 0) || (2147483646L < SeedL));
} /* End RandomizI2 */

/* -------------------------------------- */
double RandomI2( void) /* Integer Version 2 */
/* MaxLongInt must be 2^31 - 1 or larger, it is 2^31 - 1, method works */
/* Run time = 0.292 milliseconds / call, 16 mHz 80386, 10 mHz 80387 */
/* The returned double is in the range 0.0 < d < 1.0 (never = 0.0 or = 1.0) */
{
static long A = 16807L;
static long M = 2147483647L;
static long Q = 127773L; /* M div A */
static long R = 2836L; /* M mod A */
long Lo, Hi, Test;

Hi = SeedL / Q;
Lo = SeedL % Q;
Test = A * Lo - R * Hi;
if (Test > 0)
SeedL = Test;
else
SeedL = Test + M;
return (double)SeedL / M;
} /* End of RandomI2 */

/* -------------------------------------- */
int main(void) {
double Ra; /* Local variables */
int i, n;

init();
RandomizI2();
for( ; SeedL != 0; ) {
printf("Seed(0) = %ld\n", SeedL);
if (SeedL == 1) {
n = 10000;
printf(
"For an initial seed(0) = 1, the correct value of seed(10000) = 1043618065\n");
} else n = 1;
for (i = 0; i < n; i++) {
Ra = RandomI2();
}
printf("Seed(%d) = %ld\n", n, SeedL);
printf("Ra = %.18f\n", Ra);
RandomizI2();
}
printf("Random: Exit");
return 0; /* Exit main */
} /* End of main */

/* End of file Random.C */

--
| Harry J. Smith
| 19628 Via Monte Dr., Saratoga, CA 95070-4522, USA
| Home Phone: 408 741-0406, Work Phone: 408 235-5088 (Voice Mail)
| EMail: HJS...@ix.netcom.com on the Internet via Netcom NetCruiser
--

David C. Jones

unread,
Feb 4, 1995, 2:54:58 AM2/4/95
to
In <3gu78n$f...@ixnews3.ix.netcom.com> HJS...@ix.netcom.com (Harry Smith) writes:

>In <3gtmeq$b...@tribune.usask.ca> ch...@cs.usask.ca (Henry Choy) writes:

>>
>>I found that the basic rand() in C is not entirely uniformly
>>distributed, but it's not too bad.
>>
>>Over all these years, what is the best random number generator?
>>

>Try this one:

>* Oct 1988 pg 1192. It defines the Minimal Standard random number generator
>* as f(z) = 16807 * z mod 2147483647. 16807 = 7^5, 2147483647 = 2^31 - 1.
>* The seed must be between 1 and 2^31 - 2 inclusive. Period is 2^31 - 2.

I've got one very similar to it. In fact, I think Turbo Pascal uses
one very similar to it. However, there are better ones.

I don't have the code with me off hand, but for my assembly class we
designed a generator with three seeds. Each seen had a range from
1 - p, where p was a very high prime number close to 35565 and
each range was different. This effectively gave you a generator
that could go close to (2^16)^3 times without ever repeating the
same seed. If you've ever done any work on this stuff (I spent
about 8 weeks on an IS in it high school) you'll know that
the more individual seeds you have, the smoother your distrubtion
is. With this algorithm, you could put in as many seeds as you
wanted to and increase the smoothness of the distribution by
any precision you wanted to. If you want to see it I'll try to
dig it up out of my notes.

davy J.

Harry J. Smith

unread,
Feb 4, 1995, 7:08:04 PM2/4/95
to
In <3gvbsi$o...@hermes.unt.edu> djo...@ponder.csci.unt.edu (David C. Jones) writes:

>
>In <3gu78n$f...@ixnews3.ix.netcom.com> HJS...@ix.netcom.com (Harry Smith) writes:
>
>>In <3gtmeq$b...@tribune.usask.ca> ch...@cs.usask.ca (Henry Choy) writes:
>
>>>
>>>I found that the basic rand() in C is not entirely uniformly
>>>distributed, but it's not too bad.
>>>
>>>Over all these years, what is the best random number generator?
>>>
>
>>Try this one:
>
>>* Oct 1988 pg 1192. It defines the Minimal Standard random number generator
>>* as f(z) = 16807 * z mod 2147483647. 16807 = 7^5, 2147483647 = 2^31 - 1.
>>* The seed must be between 1 and 2^31 - 2 inclusive. Period is 2^31 - 2.
>
>I've got one very similar to it. In fact, I think Turbo Pascal uses
>one very similar to it. However, there are better ones.

I agree, try this one:

#include <stdlib.h> /* defines exit() and malloc() */
#include <string.h> /* defines strlen etc. */
#include <stdio.h> /* defines NULL, EOF, stdin, stdout, stderr, */
/* fprintf(), fileno(), ... for standard i/o */

extern int errno;

char name[] =
"Rando - Random Number Generater from a data encryption system written in C";
char version[] = "Version 6.0, 1995-02-04, 0900 hours";
char author[] = "Copyright (c) 1987-1995 by author: Harry J. Smith";
char address[] =


"19628 Via Monte Dr., Saratoga, CA 95070. All rights reserved.";

char usage1[] = "usage: RANDO key";
char usage2[] = " key is alphanumeric key to generate the seed";

#define POOLSIZE 2048 /* Number of integers in random number pool */
#define MAXKEY 24 /* Number of characters in short key */
#define TRUE 1
#define FALSE 0

int ri[9], /* Current random integers from the 9 generators */
rs[9], /* Initial random seeds for the 9 generators */
rr, /* Random running combination of ri[0] thru ri[8] */
*pool, /* Pool of POOLSIZE random integers */
next = 0, /* Next random no. routine to use, cycles 0 thru 8 */
poolmask = /* Mask for index to random pool = 2**N - 1 */
POOLSIZE-1;
char *buf, /* Buffer for key input */
key[MAXKEY+1]; /* The short key string in standard form */

void init( char *argv[]); /* Initialize the process */
void standard( char *cp); /* Standardize a key string */
void convkey( void); /* Convert key to 9 seeds */
int rn( int n); /* random integer from ri[n], n<9 */
int rc9( void); /* Combination of rn(0) thru rn(8) */
int Rando( void); /* Return next 16 random bits */

/* --------------------------------------------------------------------- */
void main( int argc, char *argv[])
{
int i, j, ran;
char st[5];

if(argc != 2) { /* Validate arguments */
fprintf( stderr, "\n%s\n%s\n%s\n\n", name, version, author);
fprintf( stderr, "%s\n%s\n", usage1, usage2);
exit(1);
}
init( argv); /* Initialize the process */
for (i = 0; i < 340; i++) {
ran = Rando();
sprintf(st, "%4X", ran);
for (j = 0; j < 4; j++)
if (st[j] == ' ') st[j] = '0'; /* change leading blanks to 0 */
printf("%4s", st);
}
exit(0); /* Exit main */
} /* End of main (RANDO) */

/* --------------------------------------------------------------------- */
void init( char *argv[]) /* Initialize the process */
{
int i, j, len;

pool = (int *) malloc( 2 * POOLSIZE);
if (pool == (int *) NULL) {
fprintf( stderr, "RANDO: not enough memory\n");
exit(2);
}
buf = (char *) pool;
strcpy( buf, argv[1]);
standard( buf); /* Standardize long key */
fprintf( stderr, "%s = input key in standard form\n", buf);
if( (len = strlen( buf)) > MAXKEY) {
for( i = 1; i < MAXKEY; ++i) /* Hash long key */
buf[i] += buf[i-1];
for( i = len-2; i >= MAXKEY; --i)
buf[i] += buf[i+1];
}
for( i = 0; i <= MAXKEY; ++i) /* Clear short key */
key[i] = 0;
for( i = j = 0; i < len; ++i) { /* Compress long key */
key[j] += buf[i];
if( ++j == MAXKEY)
j = 0;
}
for( i = 0; i < MAXKEY; ++i) /* Fill out key replacing */
if( !key[i]) /* nulls with spaces */
key[i] = ' ';
standard( key); /* Standardize short key */
convkey(); /* Convert short key to random */
/* number seeds */
rr = rc9(); /* Init first word of running */
/* combination of ri[0]- ri[8] */
for( i = 0; i < POOLSIZE; ++i) { /* Initialize pool, random int */
pool[i] = rr += rn( next);
if( ++next == 9)
next = 0;
}
rr = rc9(); /* Init rr for first random */
/* index into pool */

fprintf( stderr, "%s = short key in standard form\n", key);
for( i = 0; i < 9; ++i)
fprintf( stderr, "rs[%d] = %-7d ", i, rs[i]);
for( i = 0; i < 9; ++i)
fprintf( stderr, "ri[%d] = %-7d ", i, ri[i]);
fprintf( stderr, "\n");
return;


} /* End of init */

/* --------------------------------------------------------------------- */
void standard( char *cp)
{
/* Standardize a key string
* Output characters are from 33 to 95 inclusive
*/

for( ; *cp; ++cp)
{
*cp &= 127;

if( *cp > 95)
*cp -= 32;

if( *cp < 32)
*cp += 32;

if( *cp == ' ')
*cp = '/';
}
} /* End of standard */

/* --------------------------------------------------------------------- */
void convkey( void)
{
/* Convert the encryption key to 9 seeds
*
* input: key[i], i = 0, ..., MAXKEY-1
* output: rs[j], j = 0, ..., 8
*
* [0] [1] [2] [3] [4] [5] [6] ... [22] [23]
* 111111 111111 111111 111111 111111 111111 111111 111111 111111
* 6 6 4 2 6 6 2 4 6 6 6
* ****** seed0 *****...... seed1 ......***** seed2 ... seed8 ******
* 16 BITS 16 BITS 16 BITS 16 BITS
*
* 144 bit key converted to 144 bits of seed,
* seeds of zero are changed to 1.
*/

int i, j,
keyi[MAXKEY]; /* Key in integer form, 6 bits each int */

for( i = 0; i < MAXKEY; ++i)
keyi[i] = key[i] & 63;

for( i = 0, j = 0; j < 9; i += 8, j += 3)
{
rs[j] = ( keyi[i] << 10) |
( keyi[i+1] << 4) |
( keyi[i+2] >> 2);

rs[j+1] = ( keyi[i+2] << 14) |
( keyi[i+3] << 8) |
( keyi[i+4] << 2) |
( keyi[i+5] >> 4);

rs[j+2] = ( keyi[i+5] << 12) |
( keyi[i+6] << 6) |
keyi[i+7];
}
for( j = 0; j < 9; ++j) { /* Do not allow a zero seed */
if( !rs[j]) rs[j] = 1;
ri[j] = rs[j];
}
} /* End of convkey */

/* --------------------------------------------------------------------- */
int rn( int n)
{
/*
* Returns the next random integer from ri[n], 0 <= n <= 8
*/

static int repeat = TRUE;
int i;

switch( n)
{
case 0:

/* 1st Congruential Generator, 16 bits
* Generates Random integers from -32768 to 32767 inclusive
* Cycle length = 65536 = 2**16
*/

return( ri[0] = 25173 * ri[0] + 6925);

case 1:

/* 1st Shift-register Generator, 16 bits
* Random integer from -32768 to 32767 inclusive, 0 not generated
* Generator = -22620, Cycle length = 65535 = 3 * 5 * 17 * 257
*/

if( ri[1] & 1)
return( ri[1] = ( (unsigned) ri[1] >> 1) ^ -22620);

return( (unsigned) ri[1] >>= 1);

case 2:

/* 2nd Congruential Generator, 16 bits
* Random integer from -32768 to 32767 inclusive
* Cycle length = 65537 = prime, zero repeats once
*/

if( !ri[2])
{
if( repeat)
{
repeat = FALSE;
return( 0);
}
else repeat = TRUE;
}

return( ri[2] = 23629 * ri[2] + 13849);

case 3:

/* 2nd Shift-register Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Generator = -07493, Cycle length = 65521 = prime, (65536 - 15)
*/

if( ri[3] & 1)
ri[3] = ( (unsigned) ri[3] >> 1) ^ -7493;
else
(unsigned) ri[3] >>= 1;

if( ri[3] == 1)
for( i = 0; i < 14; ++i)
rn( 3); /* Throw 14 away */

return( ri[3]);

case 4:

/* 3rd Congruential Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Cycle length = 65519 = prime, (65536 - 17)
*/

ri[4] = 4821 * ri[4] + 13001;
if( !ri[4])
for( i = 0; i < 17; ++i)
rn( 4); /* Throw 17 away */

return( ri[4]);

case 5:

/* 3rd Shift-register Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Generator = -25501, Cycle length = 65497 = prime, (65536 - 39)
*/

if( ri[5] & 1)
ri[5] = ( (unsigned) ri[5] >> 1) ^ -25501;
else
(unsigned) ri[5] >>= 1;

if( ri[5] == 1)
for( i = 0; i < 38; ++i)
rn( 5); /* Throw 38 away */

return( ri[5]);

case 6:

/* 4th Congruential Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Cycle length = 65479 = prime, (65536 - 57)
*/

ri[6] = 10349 * ri[6] + 7001;
if( !ri[6])
for( i = 0; i < 57; ++i)
rn( 6); /* Throw 57 away */

return( ri[6]);

case 7:

/* 4th Shift-register Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Generator = -18916, Cycle length = 65449 = prime, (65536 - 87)
*/

if( ri[7] & 1)
ri[7] = ( (unsigned) ri[7] >> 1) ^ -18916;
else
(unsigned) ri[7] >>= 1;

if( ri[7] == 1)
for( i = 0; i < 86; ++i)
rn( 7); /* Throw 86 away */

return( ri[7]);

case 8:

/* 5th Congruential Generator, 16 bits
* Random integer from -32768 to 32767, not all generated
* Cycle length = 65447 = prime, (65536 - 89)
*/

ri[8] = 30133 * ri[8] + 14001;
if( !ri[8])
for( i = 0; i < 89; ++i)
rn( 8); /* Throw 89 away */

return( ri[8]);
}
return( 0); /* This line is never reached */
} /* End of rn */

/* --------------------------------------------------------------------- */
int rc9( void)
{
/*
* Combination of rn(0) thru rn(8), one each
*/

int i, rc;

for( rc = 0, i = 0; i < 9; ++i)
rc += rn( i);

return( rc);
} /* End of rc9 */

/* --------------------------------------------------------------------- */
int Rando( void) /* Return next 16 random bits */
{
int ran;
int ind; /* Random index into pool of random integers */

ind = rr & poolmask; /* Random index to random pool */
ran = pool[ind]; /* XOR data with random int */
pool[ind] ^= ( rr += rn( next)); /* XOR random int with next rr */
if( ++next == 9) /* Cycle to next generator */
next = 0;
return ran;
} /* End of Rando */
/* End of RANDO.C */

harm...@world.std.com

unread,
Feb 5, 1995, 3:47:45 PM2/5/95
to
In article <3h14t4$a...@ixnews1.ix.netcom.com>,

Harry J. Smith <HJS...@ix.netcom.com> wrote:
>In <3gvbsi$o...@hermes.unt.edu> djo...@ponder.csci.unt.edu (David C. Jones) writes:
>
>>
>>In <3gu78n$f...@ixnews3.ix.netcom.com> HJS...@ix.netcom.com (Harry Smith) writes:
>>
>>>In <3gtmeq$b...@tribune.usask.ca> ch...@cs.usask.ca (Henry Choy) writes:
>>
>>>>
>>>>I found that the basic rand() in C is not entirely uniformly
>>>>distributed, but it's not too bad.
>>>>
>>>>Over all these years, what is the best random number generator?
>>>>
>>
>>>Try this one:
>>
>>>* Oct 1988 pg 1192. It defines the Minimal Standard random number generator
>>>* as f(z) = 16807 * z mod 2147483647. 16807 = 7^5, 2147483647 = 2^31 - 1.
>>>* The seed must be between 1 and 2^31 - 2 inclusive. Period is 2^31 - 2.

The random number generator in O-Matrix is uniformly distributed
with a period of the order 2^144 whereas most algorithms are of the
order 2^32. If you are interested I can get forward the
source of the original algorithm.

Herman Rubin

unread,
Feb 6, 1995, 10:09:33 AM2/6/95
to
This keeps coming up, and many have posted various procedures.

There is NO procedure which can be "certifiably" good. A test which
it is guaranteed to fail is the test that it came from the procedure,
which truly random numbers will definitely not appear to be, at least
beyond the seed length or a version of it. Some have mentioned the
period, but one believed to be good was recently found to give bad
answers in a "real" problem, and its period is 2^1279 - 1, which
exceeds the total number of bits which can be constructed in many
models of the total life, including the future life, of the universe.

There are some procedures believed cryptographically strong, but they
are really time consuming. I would personally suggest taking some
fairly good procedures, with seeds in the thoudands of bits, and
XORing the results with physical random numbers, which may need to
be recycled. If the pseudo-random numbers are good, the result is
likely to be good, as the physical random nubers are extremely
unlikely to match the patterns in the pseudo-random ones, and this
same "non-matching" property is also likely to remove the weaknesses
of the pseudo-random nubers, while the pseudo-random ones will assure
the uniformity.
--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hru...@stat.purdue.edu (Internet, bitnet)
{purdue,pur-ee}!a.stat!hrubin(UUCP)

Byron Bodo

unread,
Feb 8, 1995, 1:06:13 AM2/8/95
to

Keep in mind the old saw that "Random # generators are like sex.
Even when they're bad, their often still pretty good."

The correct question should be "what's the best random # generator
for your particular project?" The quick & dirty generators are often
adequate for many common needs.

Here's some FORTRAN source for what the authors claim is a superior
generator. I can't vouch for it as I haven't tried it.

-bb

****************************************************************
<IMG ALT="" BORDER=0 SRC="internal-news-prev-article-gray"><IMG ALT="" BORDER=0 SRC="internal-news-next-article-gray"><A HREF="MAINE.94N...@altair.dfrf.nasa.gov"><IMG ALT="" BORDER=0 SRC="internal-news-prev-thread"></A><A HREF="ASTEINDL.9...@mch2ws2.tuwien.ac.at"><IMG ALT="" BORDER=0 SRC="internal-news-next-thread"></A><A HREF="newscatchup:3981nl$a...@rzsun02.rrz.uni-hamburg.de"><IMG ALT="" BORDER=0 SRC="internal-news-catchup-thread"></A><A HREF="news:comp.lang.fortran#3981nl$a...@rzsun02.rrz.uni-hamburg.de"><IMG ALT="" BORDER=0 SRC="internal-news-rtn-to-group"></A><A HREF="newsrc:"><IMG ALT="" BORDER=0 SRC="internal-news-go-to-newsrc"></A><A HREF="newsfollowup:3981nl$a...@rzsun02.rrz.uni-hamburg.de"><IMG ALT="" BORDER=0 SRC="internal-news-followup"></A><A HREF="mailto:phe...@hs.uni-hamburg.de"><IMG ALT="" BORDER=0 SRC="internal-news-reply"></A>
<HR><TITLE>random number generator: here it is</TITLE>
<H2>random number generator: here it is</H2><I>
Phillip Helbig <phe...@hs.uni-hamburg.de><BR>
2 Nov 1994 12:46:45 GMT<BR>Hamburger Sternwarte, Germany<BR>Posted to: <B><A HREF="comp.lang.fortran">comp.lang.fortran</A>
</B><BR>

</I><HR>
<PRE>
Hello everyone!

Well, here's what you've all been waiting for. Again, would
someone please crosspost this to the relevant groups (numerical
analysis and so on)?

I am including, separated by a row of 72 stars, my response
(received today) from Fred James from CERN, who wrote the code,
and my original email from James from about a year ago. What
you should cut out and compile starts right after the row of
plus signs in this original email. This consists of the
SUBROUTINE RANLUX, up until the END statement, and then the
PROGRAM RLXTST, which you can use to make sure everything is
working correctly on you computer, which includes the output
which should be produced in the comment lines at the end.

All I did was delete James's opening remarks, separate the
subroutine and the program, and compile them separately.
Except for the C's at the beginning of the lines, of course,
the test output on my computer (VAX 3100) was identical to the
test output in the RLXTST comments. All in all, less than 2
minutes work. Which speaks a lot for coding in absolutely
standard FORTRAN, as well as for the VAX compiler. (While most
compilers, if not all, which offer extensions of course support
`only' standard FORTRAN, some, such as IBM AIX on a RISC 6000,
have to be given options in order _NOT_ to support extensions
which are INCOMPATIBLE with the standard (like folding to lower
case). If you start a compiler with the defaults, then my view
is that it is OK to support extensions, but it should at least
compile standard FORTRAN without having to be explicitly told that
this is standard FORTRAN or otherwise produce results incompatible
with the standard.)

The Martin Luescher mentioned is a professor at DESY/University
of Hamburg who does theoretical elementary particle physics and
who wrote an article (DESY 93--133, September 1993, ISSN 0418-9833)
entitled `A Portable High-Quality Random Number Generator for
Lattice Field Theory Simulations' which I accidentally ran into
in the Hamburg Observatory library. Luescher directed me to Fred
James, and since then we've used the generator quite a bit, tested
it extensively just to be safe and have noticed no problems. For
most purposes, one could probably use the highest level with no
problems as far as CPU time goes.

Have fun!!

Phillip Helbig Tel. .............. +49 40 7252 4110
Hamburger Sternwarte Email .... phe...@hs.uni-hamburg.de
Gojenbergsweg 112 Fax ............... +49 40 7252 4198
D-21029 Hamburg Telex ............... 217884 hamst d

************************************************************************

Hello,
Thank you for your message about RANLUX. I am happy to hear of
satisfied users. Yes, I know a little about some of the various rng's
that are being proposed these days, in particular by the Numerical
Recipes people. I have told Bill Press about RANLUX and he has the
references. The area of rng's was always one of the weakest points in
Num. Recip., and I guess that will continue to be true, although their
algorithms will improve of course. They do a very good job in so many
areas, but you can't really expect them to be best in everything.

Press seems to be working closely with Marsaglia, which I also did at
one time, until I discovered Martin Luescher and Pierre L'Ecuyer who have
a more rigorous and more convincing approach to the problem. You may
know that Marsaglia once said: "Random numbers are like sex: ... Even
when they are bad they are still pretty good." However, we must remember
that the actual RANLUX algorithm owes much to several people including
Marsaglia:

1. Marsaglia invented the "subtract-with-borrow" algorithm which has
many practical advantages (fast and portable because all computations are
done in portable floating-point, very long period, and reasonably easy to
initialize, restart, etc.), but is not sufficiently random.
2. L'Ecuyer and Tuzaka (and perhaps others) recognized and proved that
Marsaglia's algorithm is in fact equivalent to a linear congruential
generator (which is bad) with a very big multiplier (which is good).
This gave a first basis for understanding the randomness properties and
in particular the flaws.
3. Luescher, using Kolmogorov's chaos theory, showed rigorously how to
improve the algorithm by skipping, and how much you have to skip to make
it lose all memory of its past. He also can calculate the period
exactly, with or without skipping.
4. I wrote the Fortran version of the generator.

Feel free to propagate RANLUX, but make sure to give proper credit
always to Luescher and the two articles in Computer Physics Communications
where it all is published. Thanks again, Fred.

************************************************************************

I guess that theoretical cosmology is easier than experimental cosmology
(less time-consuming) but this random number generator should be good enough
for both. The references are Lu:scher, Computer Physics Communications
79 (1994) 100, and James, CPC 79 (1994) 111.

+++++++++++++++++++++++++++++++++++
SUBROUTINE RANLUX(RVEC,LENV)
C Subtract-and-borrow random number generator proposed by
C Marsaglia and Zaman, implemented by F. James with the name
C RCARRY in 1991, and later improved by Martin Luescher
C in 1993 to produce "Luxury Pseudorandom Numbers".
C Fortran 77 coded by F. James, 1993
C
C references:
C M. Luscher, Computer Physics Communications 79 (1994) 100
C F. James, Computer Physics Communications 79 (1994) 111
C
C LUXURY LEVELS.
C ------ ------ The available luxury levels are:
C
C level 0 (p=24): equivalent to the original RCARRY of Marsaglia
C and Zaman, very long period, but fails many tests.
C level 1 (p=48): considerable improvement in quality over level 0,
C now passes the gap test, but still fails spectral test.
C level 2 (p=97): passes all known tests, but theoretically still
C defective.
C level 3 (p=223): DEFAULT VALUE. Any theoretically possible
C correlations have very small chance of being observed.
C level 4 (p=389): highest possible luxury, all 24 bits chaotic.
C
C!!! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C!!! Calling sequences for RANLUX: ++
C!!! CALL RANLUX (RVEC, LEN) returns a vector RVEC of LEN ++
C!!! 32-bit random floating point numbers between ++
C!!! zero (not included) and one (also not incl.). ++
C!!! CALL RLUXGO(LUX,INT,K1,K2) initializes the generator from ++
C!!! one 32-bit integer INT and sets Luxury Level LUX ++
C!!! which is integer between zero and MAXLEV, or if ++
C!!! LUX .GT. 24, it sets p=LUX directly. K1 and K2 ++
C!!! should be set to zero unless restarting at a break++
C!!! point given by output of RLUXAT (see RLUXAT). ++
C!!! CALL RLUXAT(LUX,INT,K1,K2) gets the values of four integers++
C!!! which can be used to restart the RANLUX generator ++
C!!! at the current point by calling RLUXGO. K1 and K2++
C!!! specify how many numbers were generated since the ++
C!!! initialization with LUX and INT. The restarting ++
C!!! skips over K1+K2*E9 numbers, so it can be long.++
C!!! A more efficient but less convenient way of restarting is by: ++
C!!! CALL RLUXIN(ISVEC) restarts the generator from vector ++
C!!! ISVEC of 25 32-bit integers (see RLUXUT) ++
C!!! CALL RLUXUT(ISVEC) outputs the current values of the 25 ++
C!!! 32-bit integer seeds, to be used for restarting ++
C!!! ISVEC must be dimensioned 25 in the calling program ++
C!!! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DIMENSION RVEC(LENV)
DIMENSION SEEDS(24), ISEEDS(24), ISDEXT(25)
PARAMETER (MAXLEV=4, LXDFLT=3)
DIMENSION NDSKIP(0:MAXLEV)
DIMENSION NEXT(24)
PARAMETER (TWOP12=4096., IGIGA=1000000000,JSDFLT=314159265)
PARAMETER (ITWO24=2**24, ICONS=2147483563)
SAVE NOTYET, I24, J24, CARRY, SEEDS, TWOM24, TWOM12, LUXLEV
SAVE NSKIP, NDSKIP, IN24, NEXT, KOUNT, MKOUNT, INSEED
INTEGER LUXLEV
LOGICAL NOTYET
DATA NOTYET, LUXLEV, IN24, KOUNT, MKOUNT /.TRUE., LXDFLT, 0,0,0/
DATA I24,J24,CARRY/24,10,0./
C default
C Luxury Level 0 1 2 *3* 4
DATA NDSKIP/0, 24, 73, 199, 365 /
Corresponds to p=24 48 97 223 389
C time factor 1 2 3 6 10 on slow workstation
C 1 1.5 2 3 5 on fast mainframe
C
C NOTYET is .TRUE. if no initialization has been performed yet.
C Default Initialization by Multiplicative Congruential
IF (NOTYET) THEN
NOTYET = .FALSE.
JSEED = JSDFLT
INSEED = JSEED
WRITE(6,'(A,I12)') ' RANLUX DEFAULT INITIALIZATION: ',JSEED
LUXLEV = LXDFLT
NSKIP = NDSKIP(LUXLEV)
LP = NSKIP + 24
IN24 = 0
KOUNT = 0
MKOUNT = 0
WRITE(6,'(A,I2,A,I4)') ' RANLUX DEFAULT LUXURY LEVEL = ',
+ LUXLEV,' p =',LP
TWOM24 = 1.
DO 25 I= 1, 24
TWOM24 = TWOM24 * 0.5
K = JSEED/53668
JSEED = 40014*(JSEED-K*53668) -K*12211
IF (JSEED .LT. 0) JSEED = JSEED+ICONS
ISEEDS(I) = MOD(JSEED,ITWO24)
25 CONTINUE
TWOM12 = TWOM24 * 4096.
DO 50 I= 1,24
SEEDS(I) = REAL(ISEEDS(I))*TWOM24
NEXT(I) = I-1
50 CONTINUE
NEXT(1) = 24
I24 = 24
J24 = 10
CARRY = 0.
IF (SEEDS(24) .EQ. 0.) CARRY = TWOM24
ENDIF
C
C The Generator proper: "Subtract-with-borrow",
C as proposed by Marsaglia and Zaman,
C Florida State University, March, 1989
C
DO 100 IVEC= 1, LENV
UNI = SEEDS(J24) - SEEDS(I24) - CARRY
IF (UNI .LT. 0.) THEN
UNI = UNI + 1.0
CARRY = TWOM24
ELSE
CARRY = 0.
ENDIF
SEEDS(I24) = UNI
I24 = NEXT(I24)
J24 = NEXT(J24)
RVEC(IVEC) = UNI
C small numbers (with less than 12 "significant" bits) are "padded".
IF (UNI .LT. TWOM12) THEN
RVEC(IVEC) = RVEC(IVEC) + TWOM24*SEEDS(J24)
C and zero is forbidden in case someone takes a logarithm
IF (RVEC(IVEC) .EQ. 0.) RVEC(IVEC) = TWOM24*TWOM24
ENDIF
C Skipping to luxury. As proposed by Martin Luscher.
IN24 = IN24 + 1
IF (IN24 .EQ. 24) THEN
IN24 = 0
KOUNT = KOUNT + NSKIP
DO 90 ISK= 1, NSKIP
UNI = SEEDS(J24) - SEEDS(I24) - CARRY
IF (UNI .LT. 0.) THEN
UNI = UNI + 1.0
CARRY = TWOM24
ELSE
CARRY = 0.
ENDIF
SEEDS(I24) = UNI
I24 = NEXT(I24)
J24 = NEXT(J24)
90 CONTINUE
ENDIF
100 CONTINUE
KOUNT = KOUNT + LENV
IF (KOUNT .GE. IGIGA) THEN
MKOUNT = MKOUNT + 1
KOUNT = KOUNT - IGIGA
ENDIF
RETURN
C
C Entry to input and float integer seeds from previous run
ENTRY RLUXIN(ISDEXT)
TWOM24 = 1.
DO 195 I= 1, 24
NEXT(I) = I-1
195 TWOM24 = TWOM24 * 0.5
NEXT(1) = 24
TWOM12 = TWOM24 * 4096.
WRITE(6,'(A)') ' FULL INITIALIZATION OF RANLUX WITH 25 INTEGERS:'
WRITE(6,'(5X,5I12)') ISDEXT
DO 200 I= 1, 24
SEEDS(I) = REAL(ISDEXT(I))*TWOM24
200 CONTINUE
CARRY = 0.
IF (ISDEXT(25) .LT. 0) CARRY = TWOM24
ISD = IABS(ISDEXT(25))
I24 = MOD(ISD,100)
ISD = ISD/100
J24 = MOD(ISD,100)
ISD = ISD/100
IN24 = MOD(ISD,100)
ISD = ISD/100
LUXLEV = ISD
IF (LUXLEV .LE. MAXLEV) THEN
NSKIP = NDSKIP(LUXLEV)
WRITE (6,'(A,I2)') ' RANLUX LUXURY LEVEL SET BY RLUXIN TO: ',
+ LUXLEV
ELSE IF (LUXLEV .GE. 24) THEN
NSKIP = LUXLEV - 24
WRITE (6,'(A,I5)') ' RANLUX P-VALUE SET BY RLUXIN TO:',LUXLEV
ELSE
NSKIP = NDSKIP(MAXLEV)
WRITE (6,'(A,I5)') ' RANLUX ILLEGAL LUXURY RLUXIN: ',LUXLEV
LUXLEV = MAXLEV
ENDIF
INSEED = -1
RETURN
C
C Entry to ouput seeds as integers
ENTRY RLUXUT(ISDEXT)
DO 300 I= 1, 24
ISDEXT(I) = INT(SEEDS(I)*TWOP12*TWOP12)
300 CONTINUE
ISDEXT(25) = I24 + 100*J24 + 10000*IN24 + 1000000*LUXLEV
IF (CARRY .GT. 0.) ISDEXT(25) = -ISDEXT(25)
RETURN
C
C Entry to output the "convenient" restart point
ENTRY RLUXAT(LOUT,INOUT,K1,K2)
LOUT = LUXLEV
INOUT = INSEED
K1 = KOUNT
K2 = MKOUNT
RETURN
C
C Entry to initialize from one or three integers
ENTRY RLUXGO(LUX,INS,K1,K2)
IF (LUX .LT. 0) THEN
LUXLEV = LXDFLT
ELSE IF (LUX .LE. MAXLEV) THEN
LUXLEV = LUX
ELSE IF (LUX .LT. 24 .OR. LUX .GT. 2000) THEN
LUXLEV = MAXLEV
WRITE (6,'(A,I7)') ' RANLUX ILLEGAL LUXURY RLUXGO: ',LUX
ELSE
LUXLEV = LUX
DO 310 ILX= 0, MAXLEV
IF (LUX .EQ. NDSKIP(ILX)+24) LUXLEV = ILX
310 CONTINUE
ENDIF
IF (LUXLEV .LE. MAXLEV) THEN
NSKIP = NDSKIP(LUXLEV)
WRITE(6,'(A,I2,A,I4)') ' RANLUX LUXURY LEVEL SET BY RLUXGO :',
+ LUXLEV,' P=', NSKIP+24
ELSE
NSKIP = LUXLEV - 24
WRITE (6,'(A,I5)') ' RANLUX P-VALUE SET BY RLUXGO TO:',LUXLEV
ENDIF
IN24 = 0
IF (INS .LT. 0) WRITE (6,'(A)')
+ ' Illegal initialization by RLUXGO, negative input seed'
IF (INS .GT. 0) THEN
JSEED = INS
WRITE(6,'(A,3I12)') ' RANLUX INITIALIZED BY RLUXGO FROM SEEDS',
+ JSEED, K1,K2
ELSE
JSEED = JSDFLT
WRITE(6,'(A)')' RANLUX INITIALIZED BY RLUXGO FROM DEFAULT SEED'
ENDIF
INSEED = JSEED
NOTYET = .FALSE.
TWOM24 = 1.
DO 325 I= 1, 24
TWOM24 = TWOM24 * 0.5
K = JSEED/53668
JSEED = 40014*(JSEED-K*53668) -K*12211
IF (JSEED .LT. 0) JSEED = JSEED+ICONS
ISEEDS(I) = MOD(JSEED,ITWO24)
325 CONTINUE
TWOM12 = TWOM24 * 4096.
DO 350 I= 1,24
SEEDS(I) = REAL(ISEEDS(I))*TWOM24
NEXT(I) = I-1
350 CONTINUE
NEXT(1) = 24
I24 = 24
J24 = 10
CARRY = 0.
IF (SEEDS(24) .EQ. 0.) CARRY = TWOM24
C If restarting at a break point, skip K1 + IGIGA*K2
C Note that this is the number of numbers delivered to
C the user PLUS the number skipped (if luxury .GT. 0).
KOUNT = K1
MKOUNT = K2
IF (K1+K2 .NE. 0) THEN
DO 500 IOUTER= 1, K2+1
INNER = IGIGA
IF (IOUTER .EQ. K2+1) INNER = K1
DO 450 ISK= 1, INNER
UNI = SEEDS(J24) - SEEDS(I24) - CARRY
IF (UNI .LT. 0.) THEN
UNI = UNI + 1.0
CARRY = TWOM24
ELSE
CARRY = 0.
ENDIF
SEEDS(I24) = UNI
I24 = NEXT(I24)
J24 = NEXT(J24)
450 CONTINUE
500 CONTINUE
C Get the right value of IN24 by direct calculation
IN24 = MOD(KOUNT, NSKIP+24)
IF (MKOUNT .GT. 0) THEN
IZIP = MOD(IGIGA, NSKIP+24)
IZIP2 = MKOUNT*IZIP + IN24
IN24 = MOD(IZIP2, NSKIP+24)
ENDIF
C Now IN24 had better be between zero and 23 inclusive
IF (IN24 .GT. 23) THEN
WRITE (6,'(A/A,3I11,A,I5)')
+ ' Error in RESTARTING with RLUXGO:',' The values', INS,
+ K1, K2, ' cannot occur at luxury level', LUXLEV
IN24 = 0
ENDIF
ENDIF
RETURN
END
C +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROGRAM LUXTST
C Exercise for the RANLUX Pseudorandom number generator.
C
DIMENSION RVEC(1000)
DIMENSION ISDEXT(25)
C
C check that we get the right numbers (machine-indep.)
WRITE (6,'(/A)') ' CALL RANLUX(RVEC,100)'
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX default numbers 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX default numbers 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' CALL RLUXGO(0,0,0,0)'
CALL RLUXGO(0,0,0,0)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury level 0, 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury level 0, 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' CALL RLUXGO(389,1,0,0)'
CALL RLUXGO(389,1,0,0)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury p=389, 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury p=389, 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' CALL RLUXGO(75,0,0,0)'
CALL RLUXGO(75,0,0,0)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury p= 75, 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX luxury p= 75, 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' test restarting from the full vector'
CALL RLUXUT(ISDEXT)
WRITE (6,'(/A/(1X,5I14))') ' current RANLUX status saved:',ISDEXT
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX numbers 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX numbers 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' previous RANLUX status will be restored'
CALL RLUXIN(ISDEXT)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX numbers 1- 5:',
+ (RVEC(L),L=1,5)
CALL RANLUX(RVEC,100)
WRITE (6,'(A/9X,5F12.8)') ' RANLUX numbers 101-105:',
+ (RVEC(L),L=1,5)
C
WRITE (6,'(/A)') ' test the restarting by skipping'
CALL RLUXGO(4,7674985,0,0)
CALL RLUXAT(I1,I2,I3,I4)
WRITE (6,'(A,4I10)') ' RLUXAT values =',I1,I2,I3,I4
DO 150 LI= 1, 10
150 CALL RANLUX(RVEC,1000)
CALL RLUXAT(I1,I2,I3,I4)
WRITE (6,'(A,4I10)') ' RLUXAT values =',I1,I2,I3,I4
CALL RANLUX(RVEC,200)
WRITE (6,'(A,2F10.6)') ' Next and 200th numbers are:',
+ RVEC(1), RVEC(200)
CALL RLUXGO(I1,I2,I3,I4)
CALL RANLUX(RVEC,200)
WRITE (6,'(A,2F10.6)') ' Next and 200th numbers are:',
+ RVEC(1), RVEC(200)
C
WRITE (6,'(/A)') ' The following should provoke an error message'
CALL RLUXGO(4,11111,31,0)
STOP
C
C OUTPUT FROM THE ABOVE TEST PROGRAM SHOULD BE:
C --------------------------------------------
C CALL RANLUX(RVEC,100)
C RANLUX DEFAULT INITIALIZATION: 314159265
C RANLUX DEFAULT LUXURY LEVEL = 3 p = 223
C RANLUX default numbers 1- 5:
C 0.53981817 0.76155043 0.06029940 0.79600263 0.30631220
C RANLUX default numbers 101-105:
C 0.43156743 0.03774416 0.24897110 0.00147784 0.90274453
C
C CALL RLUXGO(0,0,0,0)
C RANLUX LUXURY LEVEL SET BY RLUXGO : 0 P= 24
C RANLUX INITIALIZED BY RLUXGO FROM DEFAULT SEED
C RANLUX luxury level 0, 1- 5:
C 0.53981817 0.76155043 0.06029940 0.79600263 0.30631220
C RANLUX luxury level 0, 101-105:
C 0.41538775 0.05330932 0.58195311 0.91397446 0.67034441
C
C CALL RLUXGO(389,1,0,0)
C RANLUX LUXURY LEVEL SET BY RLUXGO : 4 P= 389
C RANLUX INITIALIZED BY RLUXGO FROM SEEDS 1 0 0
C RANLUX luxury p=389, 1- 5:
C 0.94589490 0.47347850 0.95152789 0.42971975 0.09127384
C RANLUX luxury p=389, 101-105:
C 0.02618265 0.03775346 0.97274780 0.13302165 0.43126065
C
C CALL RLUXGO(75,0,0,0)
C RANLUX P-VALUE SET BY RLUXGO TO: 75
C RANLUX INITIALIZED BY RLUXGO FROM DEFAULT SEED
C RANLUX luxury p= 75, 1- 5:
C 0.53981817 0.76155043 0.06029940 0.79600263 0.30631220
C RANLUX luxury p= 75, 101-105:
C 0.25600731 0.23443210 0.59164381 0.59035838 0.07011414
C
C test restarting from the full vector
C
C current RANLUX status saved:
C 16156027 16534309 15243811 2751687 6002207
C 7979506 1301976 4567313 4305996 5872599
C 12003090 2146823 12606367 4111505 5979640
C 12739666 10489318 14036909 11729352 8061448
C 7832659 6069758 3197719 1832730 75080216
C RANLUX numbers 1- 5:
C 0.22617835 0.60655993 0.86417443 0.43920082 0.23382509
C RANLUX numbers 101-105:
C 0.08107197 0.21466845 0.84856731 0.94078046 0.85626233
C
C previous RANLUX status will be restored
C FULL INITIALIZATION OF RANLUX WITH 25 INTEGERS:
C 16156027 16534309 15243811 2751687 6002207
C 7979506 1301976 4567313 4305996 5872599
C 12003090 2146823 12606367 4111505 5979640
C 12739666 10489318 14036909 11729352 8061448
C 7832659 6069758 3197719 1832730 75080216
C RANLUX P-VALUE SET BY RLUXIN TO: 75
C RANLUX numbers 1- 5:
C 0.22617835 0.60655993 0.86417443 0.43920082 0.23382509
C RANLUX numbers 101-105:
C 0.08107197 0.21466845 0.84856731 0.94078046 0.85626233
C
C test the restarting by skipping
C RANLUX LUXURY LEVEL SET BY RLUXGO : 4 P= 389
C RANLUX INITIALIZED BY RLUXGO FROM SEEDS 7674985 0 0
C RLUXAT values = 4 7674985 0 0
C RLUXAT values = 4 7674985 161840 0
C Next and 200th numbers are: 0.019648 0.590586
C RANLUX LUXURY LEVEL SET BY RLUXGO : 4 P= 389
C RANLUX INITIALIZED BY RLUXGO FROM SEEDS 7674985 161840 0
C Next and 200th numbers are: 0.019648 0.590586
C
C The following should provoke an error message
C RANLUX LUXURY LEVEL SET BY RLUXGO : 4 P= 389
C RANLUX INITIALIZED BY RLUXGO FROM SEEDS 11111 31 0
C Error in RESTARTING with RLUXGO:
C The values 11111 31 0 cannot occur at luxury level 4
END

************************************************************************

Darrah Chavey

unread,
Feb 8, 1995, 9:29:02 PM2/8/95
to
In article <3gtmeq$b...@tribune.usask.ca>, ch...@cs.usask.ca (Henry Choy) wrote:

> I found that the basic rand() in C is not entirely uniformly
> distributed, but it's not too bad.
>
> Over all these years, what is the best random number generator?

There's no real answer to that, since "best" is not really well-defined.
However, the following is one written by one of my students, based on some
of the recent work done on such generators. It was then extensively tested
by a Statistics professor, and certified as strong.

global static variables: seed1, seed2 : integer;

procedure RandomInit (Stream: integer);
begin
{ Get the current day, hour, minute, second, and initialize your seed }
{ along the following lines: }
randseed := (Day + 1) * (Hour + 1) * (Minute + 1) * (Second + 1);
seed1 := HiWord(randseed);
seed1 := LoWord(randseed);
end;

function URand: extended; { "Extended" is Mac-speak for a 16-byte real. }
{ This returns a random real number in the range [0, 1). It can be easily }
{ scaled to any other range you want. }
var
z, k: integer;
begin
{ first linear congruential generator }
k := seed1 div 206;
seed1 := 157 * (seed1 - k * 206) - k * 21;
if seed1 < 0 then
seed1 := seed1 + 32363;

{ second linear congruential generator }
k := seed2 div 217;
seed2 := 146 * (seed2 - k * 217) - k * 45;
if seed2 < 0 then
seed2 := seed2 + 31727;

{ combine the values }
z := seed1 - seed2;
if z > 706 then
z := z - 32362;
if z < 1 then
z := z + 32362;

{ Place Urand in the [0,1) range }
Urand := z * 0.000030899
end;

-- Darrah Chavey Those who do not understand Unix are
Math/CS Dept. condemned to reinvent it, poorly.
Beloit College -- Henry Spencer, Univ. Toronto Unix hack

Douglas Zare (NC)

unread,
Feb 8, 1995, 9:52:37 PM2/8/95
to
On 3 Feb 1995, Henry Choy wrote:

> I found that the basic rand() in C is not entirely uniformly
> distributed, but it's not too bad.
>
> Over all these years, what is the best random number generator?

Calculus exams?

> --
> Henry Choy "Math class is hard" - Barbie
>
> e-mail: ch...@cs.usask.ca I AGREE!

Douglas Zare
za...@cco.caltech.edu

David Bernier

unread,
Feb 9, 1995, 1:31:13 AM2/9/95
to
I wrote a fortran subroutine that generates pseudorandom fortran
integers and reals in [0,1] . The method used is a linear feedback
shift-register. See chapter 9 of the book _Random Number Generation
and Quasi-Monte Carlo Methods_ by H. Niederreiter for more
information. I use the primitive trinomial in F2[x]
x^4423 + x^271 + 1 reported by Neal Zierler in _Information and
Control_ (15), 67-69 , 1969 . Note that addition of integers in
fortran is isomorphic to the additive group mod 2^32 ( Z_{2^32} ) .
Because I use a primitive trinomial, the period of the generator
for the random integers is at least 2^4423-1 . For the random
reals, the same is expected to be the case, although I'm not
absolutely sure because many fortran integers result in the same
random real number in [0,1] (see the subroutine part of the source
code below).

I give 3 demo programs using this subroutine below. In addition, one
needs a large file of random integers (named seed5000). A seed file
is included also. If you want to randomize the output, simply replace
(say) the first 10 lines of seed5000 by any fortran integers
of your choice.

Here are some stats about the demo program rndtoss.f below:
On a sparc 20, rndtoss.f ran for 43 seconds.
This gives a rate of about 450000 coin tosses per second.


I hope the demo programs are enough so that someone else can figure
out how to use this subroutine. If you get some strange correlations
or unusual results with this subroutine, I'd be interested in hearing
about it.

David Bernier dber...@mat.ulaval.ca

demo program rnd.f
------------------------------------------------------------------

dimension ifrandom(3),iseedrandom(4423),iscrandom(4423)
open(95,file='seed5000')
do 1997 i=1,4423
read(95,*)iseedrandom(i)
iscrandom(i)=1+mod(i,4423)
1997 continue
ifrandom(1)=1
ifrandom(2)=272
ifrandom(3)=4423
* the preceding lines need to be executed before calling
* the random subroutine .
* the variable names ifrandom iseedrandom iscrandom
* and the subroutine name random need to be reserved for the
* use of the random subroutine. the output of random is put
* in the integer variable integer and the real variable real .
* integer is a pseudorandom fortran integer in the range
* -2147483648 to 2147483647 . real is a pseudorandom real
* number in the range [0,1] following a uniform distribution.
* there is no problem in changing the names of the two
* output variables of random, ie integer and random.
* this demo program computes and sends to stdout 20 values
* of random integers and random reals.
* this subroutine is for free use and is public domain
do 50 j=1,20
call random(iseedrandom,ifrandom,iscrandom,integer,real)
write(6,*)integer,real
50 continue
end
* the MAIN program ends on the preceding line
* the random subroutine begins on the following line
subroutine random(iseed,if,isc,int,real)
dimension iseed(1),if(1),isc(1)
int=iseed(if(1))+iseed(if(2))
if(1)=isc(if(1))
if(2)=isc(if(2))
if(3)=isc(if(3))
iseed(if(3))=int
real=abs(int/2147483648.)
return
end
--------------------------------------------------------------------

demo program rndtoss.f
----------------------------------------------------------------------

dimension ifrandom(3),iseedrandom(4423),iscrandom(4423)
integer distrib(21)
open(95,file='seed5000')
do 1997 i=1,4423
read(95,*)iseedrandom(i)
iscrandom(i)=1+mod(i,4423)
1997 continue
ifrandom(1)=1
ifrandom(2)=272
ifrandom(3)=4423
* the preceding lines need to be executed before calling
* the random subroutine .
* the variable names ifrandom iseedrandom iscrandom
* and the subroutine name random need to be reserved for the
* use of the random subroutine. the output of random is put
* in the integer variable integer and the real variable real .
* integer is a pseudorandom fortran integer in the range
* -2147483648 to 2147483647 . real is a pseudorandom real
* number in the range [0,1] following a uniform distribution.
* there is no problem in changing the names of the two
* output variables of random, ie integer and random.
* this demo program simulates the following experiment:
* toss a fair coin 20 times and note the number of tails;
* repeat 1000000 times and write how many times you got
* 0 , 1, ... , 20 tails .
* this subroutine is for free use and is public domain
do 50 j=1,21
distrib(j)=0
50 continue
do 60 i=1,1000000
ntails=0
do 65 j=1,20
call random(iseedrandom,ifrandom,iscrandom,integer,real)
if(real.lt..5)then
ntails=ntails+1
endif
65 continue
distrib(ntails+1)=distrib(ntails+1)+1
60 continue
do 80 i=0,20
write(6,*)i,distrib(i+1)
80 continue
end
* the MAIN program ends on the preceding line
* the random subroutine begins on the following line
subroutine random(iseed,if,isc,int,real)
dimension iseed(1),if(1),isc(1)
int=iseed(if(1))+iseed(if(2))
if(1)=isc(if(1))
if(2)=isc(if(2))
if(3)=isc(if(3))
iseed(if(3))=int
real=abs(int/2147483648.)
return
end
----------------------------------------------------------------------

demo program rnddeck.f
-----------------------------------------------------------------------

dimension ifrandom(3),iseedrandom(4423),iscrandom(4423)
dimension im(52),int(52)
logical ct
open(95,file='seed5000')
do 1997 i=1,4423
read(95,*)iseedrandom(i)
iscrandom(i)=1+mod(i,4423)
1997 continue
ifrandom(1)=1
ifrandom(2)=272
ifrandom(3)=4423
* the preceding lines need to be executed before calling
* the random subroutine .
* the variable names ifrandom iseedrandom iscrandom
* and the subroutine name random need to be reserved for the
* use of the random subroutine. the output of random is put
* in the integer variable integer (which is replaced below by
* isum) and the real variable real (replaced below by r) .
* integer is a pseudorandom fortran integer in the range
* -2147483648 to 2147483647 . real is a pseudorandom real
* number in the range [0,1] following a uniform distribution.
* there is no problem in changing the names of the two
* output variables of random, ie integer and random.
* this demo program tries to answer the question:
* if two people each shuffle a 52 card deck, and then each
* turns over a card and announces the kind (A,2,3,... 10,J,Q,K),
* what is the probability that there will be no match in the
* 52 announcements? this problem was discussed in 1994 in sci.math
* and the exact probability was reported to be .016232727...
* (the name of the thread was:
* Probability problem, no match in 52 card deck )
* this subroutine is for free use and is public domain
do 40 i=1,52
im(i)=mod(i,13)
40 continue
do 70 j=1,100
do 75 l=1,50000
ct=.true.
do 85 ix=1,52
call random(iseedrandom,ifrandom,iscrandom,isum,r)
int(ix)=isum
85 continue
do 95 ix=1,52
imin=2147483647
do 105 iy=1,52
if(int(iy).lt.imin) then
imin=int(iy)
isa=iy
endif
105 continue
ct=ct.and.(im(ix).ne.im(isa))
int(isa)=2147483647
95 continue
ic=ic+1
if(ct)then
isuc=isuc+1
endif
75 continue
r=isuc/(ic+0.)
write(6,*)ic,isuc,r
70 continue
end
* the MAIN program ends on the preceding line
* the random subroutine begins on the following line
subroutine random(iseed,if,isc,int,real)
dimension iseed(1),if(1),isc(1)
int=iseed(if(1))+iseed(if(2))
if(1)=isc(if(1))
if(2)=isc(if(2))
if(3)=isc(if(3))
iseed(if(3))=int
real=abs(int/2147483648.)
return
end
------------------------------------------------------------------------

filename=seed5000 (5000 lines)
-------------------------------------------------------------------------
-391067836
-798168827
1743097453
908835402
1947666044
-946668368
922885915
-2028164753
-1148153365
-887821477
-2140879836
-1019056035
-1502902238
1097101345
636469694
-895270494
-1707427404
1718428705
1686593045
243449852
-2040878494
-566641823
-96196150
-819455204
1999496052
1114159882
116084502
-916597783
-1411307451
485290300
-2112654540
-1633385110
1938125211
-299085840
-1698248874
-1376963243
230641673
-887491069
778694469
1028011321
625082119
850902584
427038966
-920908948
-1281427744
1876094375
-1866496277
-1871118431
1100210431
-1881580941
-1863915860
240996634
552721189
-1090388722
-1974532589
536033857
-1937630041
380885875
-1838616188
-1410627843
1830892158
1617385436
1718398085
-727093226
1600875536
-984704018
-710700882
-343609443
-244590423
-845840758
2101786336
1102162143
967510020
-376332473
-1417143968
-2097167690
-493862970
29875972
557901311
505719380
-619332097
-1876318312
-1489920290
952527431
-1535356638
-1334074772
-1300996334
853732711
-329083704
-2101625988
1107361091
-371073621
429229825
753936973
-1739084613
-988043483
-685147293
894486240
1874424240
667750463
-897898406
-938213377
-1672779800
1971211432
-1923871448
-2053401492
-1608447753
1250967142
-22099040
1700929867
-1061964337
-409241262
1026946437
197494511
1146416443
-1829230486
-811924494
1231718136
-682950893
-589679345
419559804
1960968066
670750080
1422250414
833409676
1328665127
-15452466
1417864892
-1948096200
-284042477
-1665243841
-161904016
1415314449
928397146
1204484860
-1680805248
1607065020
-1925507349
-1744988988
-508751221
-143223421
524252765
-624050950
930188514
-1196858682
1645942754
-290012290
1632590294
513075069
-1470871747
-241032792
2098823053
1263649057
714861520
1226465031
1033268830
-1581615450
931530906
-1577031259
1569888013
1270885172
1766804266
-1378977994
441204502
47709283
1763178759
-318316448
-885296394
-1993250261
1476886302
421763754
-1867039713
-628934820
-1443210519
708179741
-242148541
-980347803
711259251
1243597863
1626645205
-1001482405
1421185845
1602790870
-1642638848
1218279847
1866942006
-2001678453
-1954297044
-1986569495
-712650130
-640101303
1368124814
700677855
30832180
-1989073647
-1957115999
-2090040964
-70181950
1496880466
741329680
1130499105
1702034976
1074889715
-539966801
-1326763023
380110338
356844579
-374842007
-1357041050
666968479
1512043190
104194217
2111199950
1567798687
-1077738997
296638369
-830124228
909008631
2021671432
428098120
347614220
-1445128410
1834174135
-804130312
-2057690837
-972461809
-1876392703
-1896724958
8533848
686515299
2130912652
844119429
-592782127
-1080898907
1527958527
181609347
-571920011
1595418052
11815861
278135087
740135158
1711361752
-970794595
-2055185238
-1457112706
618414309
-1996837788
1337299983
75330753
-1148515694
2132857744
387884840
869819775
-1284689858
579965993
1070908595
66447308
1238186986
-1515753363
-943958114
-1420231069
-1034742608
86756759
278379725
-1513268856
-1856532974
-18491648
512488596
-663020571
-1864201352
-227551835
1092793614
1930924586
1238980540
-790763788
839739965
791024340
-445777430
1696521569
211225278
-14740039
1127968022
1590483940
-1736211919
-889760876
-474238225
820992904
-420210606
145621912
-1726589005
-854450217
-1730823138
-1647076872
1932072722
1276099509
-1566132175
-564473661
974833152
89199688
-1535229723
-2097673395
-1190234570
2056548643
1918982355
-573993726
432491963
1919771546
-1124672436
-139531990
81320791
-1815590142
832714784
-636789931
-235280214
2129151957
-45443736
1092056717
-1840008757
-1673406857
1117505968
1205289462
112771657
-1296221158
89052866
-1314951828
-518469919
727185328
-2123310725
-1908944640
-388333892
1734319875
-1552939868
258454957
-1744488797
-153343705
1665008400
1578910363
-1301282225
-2035297209
-1407362531
322030231
1537692822
1263958240
1537419214
1971483278
-1384546725
837024856
1013700959
-612234612
-2092724651
-723476449
1853008466
-1759444530
798179302
1580320686
1325345976
-759554261
224263676
-276182568
1349709529
2140980755
-710993171
-1313315689
1398073992
1998370133
-1398232270
53378868
-1288128152
150236757
-609209866
-448558172
574958961
697024675
-506070064
1954916222
-871226613
1746577773
2010145919
1393691235
-299219573
-1550336389
1692940938
-2049910687
-1487153830
-107532382
485747019
254280599
2047314285
2041127622
53990979
-1401537341
-116812069
-751686895
-906679536
-1241701215
-437435075
407651685
-550714331
-1624492585
1696677676
-633961875
725279886
-1214158263
-1854848453
900083703
-617383654
197772394
1449309460
-176208233
-28017634
-1008701009
-1545928593
1517915894
2088521978
-1440952440
368887219
649774807
-1714043084
1160081670
-1884449222
-348608784
-1339164432
1198997441
-108260012
-1004804042
656815166
452961839
-1928425671
-1968134655
111526090
383479652
170808731
38319545
886886023
-1740101489
-1402415100
385114210
1337604828
193274564
-1800550646
2017598627
1099938382
1448017773
-1284599882
-1255156748
-419448885
895104749
-1645008605
1176046692
-510031180
774219693
-264318240
806173353
-1922071917
1148826536
-1878368416
-967187431
164907520
1609575285
1883581257
-731433817
595441977
-1488863
-422647557
-1473593082
-1589417372
1384393945
1382569295
27270069
-1747865468
-476230709
-1153233682
-1093263985
-786264154
130375710
-199243743
-344877632
262608745
613824170
-793567207
1021619649
-185055852
-2068474196
1788656288
860349207
-854930948
1804429646
533530073
-309390923
-2096302939
1539082199
1973141821
-345878273
-1217753267
-771340686
1473639341
-1237909178
-1259118877
1787293856
431064649
2127976907
-1231613216
-1473050423
-2106488781
853676711
-1134069556
-2071587229
1201021787
-1003458465
1590053111
725963348
639128632
853913361
-873187745
211393863
1818406232
1234716603
-1841847462
-77942993
1525101436
962003060
185851051
1716195798
676260351
-2008360425
-1996422912
1920587936
-2069290019
-394004740
-703102745
522825435
-1216294101
1644629414
-623344380
-892869478
957619856
97857285
-1948337740
947866995
-782196388
-153441839
226062807
704410357
1637914576
600850359
53440450
1443936536
841770829
2103582545
1802505763
1933256773
-484088935
812403063
-684064661
1195514494
-250480697
268650318
1716305191
47168909
390929507
-1494877413
-548833062
-1475389394
709590130
-426798040
-2131808961
-1322723683
-1813059091
675531875
642650882
-189718113
-533424558
-1261671833
751183636
1596425656
-1339244354
-1739524506
1281986462
-739774877
-1221369307
660466544
1435430893
-759805191
1909153657
-486645395
-529146574
-929793631
430362803
1296941798
-1253001825
-1147795504
2083806077
-859837085
-1292553666
-750651377
593441574
-1802359851
1106982044
-2054559469
1990248943
-465447490
848432513
-6517807
1009518101
-317510453
-1711485387
-1314867205
741226018
-986642225
2042405727
802142852
1655695124
183257750
-1361389279
-139941831
-409184461
-1495380960
212051685
-482294124
-1367437541
-2023542674
165163485
-986014697
-220881245
-1056265807
-2042922985
-1237924361
1722159837
-586299184
-1916931542
-819470155
-1786955203
-1585602731
-42568021
853928680
1378795368
-774699837
1489598898
18552909
-807194117
1474044535
21735381
-638627402
-1628124848
1737473357
1265682318
2083525147
-174586376
439645326
1810615297
1886924116
1327465584
660872736
-1815646160
1642710663
-378523001
-117869564
660011918
-1860965874
1168220596
1738106749
-2110537439
-1118092338
82948854
1206226529
-706135317
1703356907
-686261842
257597765
-881660174
328082797
1034388366
739418627
214925067
-864790551
-877067335
-2102741996
-258317802
-2106623741
-641456616
-1273077212
341295357
-892806623
1773749257
86694513
-1710188691
-338915665
-120520329
-65951207
-1327276648
590761929
1869143766
455463362
2022337420
1487234517
-1237512618
1704875175
-486097029
-1650076445
418808288
-1384070307
-824379195
1035612352
1411935352
1119621249
397086282
498163887
-895210748
664385955
189186807
-1646156711
204618621
1827578923
567854322
1478303161
799274597
-967343199
935374190
-1606947560
-149241138
-258692972
1585517731
-373014601
78442217
-933580542
-610767709
-1903548909
-790834674
-912527990
1110240738
-1949557194
-1546970603
1819677987
176676733
464631345
-1444124953
-1484428349
1747391322
133893857
-502447705
1974707186
-4491954
1353236369
-321086185
1322472031
-1176628728
-496682307
-1936980483
-607593686
-912993815
1966075328
766347771
-943660947
-2006405382
-1975007702
1027511229
1431354774
-1953192183
-1523060047
532088985
276331375
505642739
2093391557
1283727360
-1632132924
1965951134
93313363
-1699657277
-323916326
1562893714
1911426827
1693500302
-274940936
-1221670223
-2071790345
-873742686
1194700942
-508628294
2051144040
-516672507
498362617
1329589754
-1129289800
996899159
-1680602545
-1616119146
1371969207
-355277033
-208913398
-2061441771
2046328045
1898416479
40493424
-2070640807
-1404207112
383964233
448061382
-2014644803
1847571940
853536261
806253917
-1334060322
-769385366
-1614326434
301212190
1406017157
-404304877
-1245794917
1461973814
458420398
1443748637
2117224302
55101674
736247143
-617614280
267180390
-621865853
-224403772
2034169511
95733315
158600383
538293974
-1103262007
-160327557
-306770961
-623649429
-1317957672
-562205874
1361484639
1925066060
836914579
242693643
-227093802
-108850699
-265794371
1809620456
-2002108073
-669220327
630944875
86375125
512279979
-74303023
-1298148936
-1452178429
1731025971
-2061262286
-1980810049
1990617091
-919809187
1278198860
-1644507937
748893117
-666358593
-222661584
-1052323010
537155192
1411522188
-1532946905
1731502160
551598780
-2081113483
-279063882
-1021848804
-783355817
-283202887
-121575323
-940173826
-1600878405
-1794731690
668530439
-1499168826
2096725295
-795961704
1042168939
581477861
-2087507773
-430020809
71084750
1306903660
2030842341
198172669
2014849546
1821480676
-729054735
-1160406871
-1596432626
1965572504
414874556
-796397473
-780653280
537699490
121288103
1228461161
-168455429
-1808820844
-815540029
-1433305970
-756020558
1244544759
139216664
1118792555
1192647210
-740512313
-186116384
-454019924
-28033354
-1838343547
812852453
-1542473673
-686023475
1075954744
-725985851
1564175427
-150349722
1612001511
2026647801
-490521097
-1836213674
-1571875786
-1568063082
-2140268449
-1952965570
-149585620
144783484
796828825
-887149708
-255519371
211408464
497258709
449215070
287218179
2029129248
1872770653
-1740118825
1910265044
479312486
372489838
1011984880
1425624705
466685401
-1047582107
1546262393
1346756604
-487531707
1182628665
-1948805843
806429934
53472718
1341705418
1759672023
-1034176457
-869980165
-2106131300
181020303
-956845720
-180043594
-1820677812
1705846370
-1087969757
-1743283222
-1956313273
1219604579
1408617411
-1752660069
-1739877
1283349548
-700808214
1803826536
2065848640
-1665194781
-1665768798
-431394664
-1092343796
-599874654
-628909194
446513485
2017428400
500239400
-790238165
1039841687
83113425
-984214889
286680581
1476478251
1224362716
389004260
-2070704563
1877446339
-223329082
2125349033
1614932141
348759578
1810012663
-1731310253
325648256
-2098903486
-1022340877
-982502837
120151909
1545675081
1524019175
-399698496
1114382604
-1498420794
1816392562
-1638607212
-1534245955
1964570760
537747564
1332612188
1104267189
2118522037
-519519116
-1027155417
-2104080236
-1595534975
86439179
-1229869375
899695503
-1834757015
1979434210
-1055507724
1481277122
-1468605483
1653944712
728452943
983198486
-2129728597
-683316114
1870047418
173754363
247608587
-1816030682
675524800
-463107384
-386935205
1392160268
-95480925
-701352095
2087601846
-1070727595
1122352454
1457784601
504764186
1795649071
14013832
1950887551
1735165845
-1535242426
-30603118
-942781661
-317346746
1116628498
697270132
-347364800
1104887989
-968710979
560186017
923958767
1935249263
260628614
-1535610006
1762656385
2119069370
1252443216
-345554549
-1821599431
-1329297732
-244875731
-648147568
1061546799
-573995931
-1793981216
-846384975
-1235649725
704427847
-1110873688
422329680
-2128025551
861115597
42947949
-1006063713
-971640820
1670579376
886036110
190623246
75402938
1309777344
1209070563
-1865848275
1946312293
234659194
-227342176
1543690676
-821617378
1635755599
-324276981
1100381958
-2044596073
217746822
914781672
-664481537
2064298034
1796569014
-849937048
2054234128
-302146384
1315990911
-993483241
-1910857374
1293927221
-1767727535
92006561
1817566827
-936800706
-862127844
1895618776
1065755302
1536615431
-1140627978
1486295113
450554135
701693192
-1005728859
-298486456
-1160496932
742548538
460134171
-504354272
-1228544341
1090531912
876806085
696797053
-1010571588
-1588953094
-970318418
283892282
-293494519
984683424
-240717609
2032776084
60555685
-2112584615
796894593
690043926
1364669385
445978427
-1787853363
-984696828
1748390742
1595916049
110337266
-1572273788
-678098181
482853418
-674786749
-165591497
-1760116443
-2004493140
2014731214
-332788952
-293196123
-556099831
-119831395
-187731778
-1554007469
-648940449
2072536737
-1925387660
-664183682
-1938320124
1527275354
1368538851
-83356804
1468815778
-1675273471
-286713892
-1255984792
-34870851
-1421603834
186112161
-1706182736
568930743
-1484633680
1900336246
1981309876
1966082499
-1709762711
1605587847
-735167734
-784192715
1385592603
1093852384
-438005114
1841363613
-2138925200
-72767361
-248834588
770005710
-1568660234
-335824646
-888178052
1294749741
-2102667039
-1936707877
-1284033736
463919734
-692099984
-231325268
1121708445
-1368056885
2028763346
-298869889
-2087647425
1756410776
1172990427
-1699138344
-812629633
-2106873808
-275743821
1862113423
1411919386
-502301838
1078745397
691156572
260884237
514293889
-778736298
1795265103
985816557
-875443361
-236578805
760308696
268809918
1585240648
1940250532
-1371456709
-759009560
30059882
168274161
243985382
407920315
-1478624024
-329212789
1736526474
-880477013
374835654
-1706824935
683308995
-971764723
-502383553
1033249084
1329467069
234594065
-1742338881
-788679028
1805844306
-1167888828
1702864828
-1656968180
911006277
-1066061223
759110990
365965004
-1246404257
-1875635596
-1020337496
2116126997
1033181632
-1519364349
1934163606
658409726
-1691681205
-261463796
-1186332907
935188999
70454228
-1723495569
1301297378
-1860450586
429696044
1347346739
-978015369
53436771
459478184
142991196
-2060762058
-1849619050
-864101767
1764906989
-1499131907
-926445847
1857576952
306839920
-194816877
2136144157
-336309060
-190348938
23488857
-1374200738
1902502632
1492609420
1663623890
-745199137
-739683650
-1492476490
-1892406421
-1759174781
-1825791197
170198358
-1930595786
702118591
1161715834
2416382
-247140733
337238501
-189820232
1950926595
11441061
204964301
-280408916
-1545405210
-361541193
-1398095330
-1797309927
-201426616
1381126540
195415002
740690862
831368199
-364758588
30361940
-323249252
1167753847
1103277413
671488012
415058010
-7131430
-559345523
740717010
2076851563
1279821438
-1824010903
498199627
1448951959
-269100891
772260638
307150871
-1237663565
-776429552
-1487168962
1645084278
675641793
-61444914
-233065716
-865954895
-296591226
-1690873993
-393628702
-1417407618
1463919618
611697387
-1366744557
1651173628
375743011
-1824978589
-942064456
1493859596
-1043432404
-1492494131
1217963542
-276051945
679558346
588285019
-363678612
-710404897
-1105650193
-1615659022
1476601633
1598038508
1244507319
228137695
-102123250
-815337544
-123240040
-886157359
-699560592
742957793
-1305891075
561620162
-771345852
-1730745671
-238485378
-1335926595
27842617
814105850
-139460683
-1895415422
703240009
-1957404757
-241084392
-417042884
1441672455
-1855937929
1548685278
-1336678874
2127021384
116541809
-1549846566
764453394
935766191
1269270385
992875943
45755436
-1714164643
1507963417
-1569053109
-333171224
1083672921
1512106987
-1514406224
1129797049
1824698301
536064161
-854963168
1317089917
-1506827837
-138398983
1151864203
1082200660
-592486611
427216520
-108798135
-1669986464
1456731804
-1760599997
-1099782762
-1992727601
-1043080827
939318910
1620015218
-146332177
436444705
-2131977726
-208632176
-963149095
-1028941416
-582252680
-1142093603
-872608251
96311663
-873019318
-493823212
-858171499
796262064
1799040059
-516901511
-1175801953
1282781299
618595200
-677808501
-1529058292
1528842484
1243275851
391069034
2009791397
1571340092
-2123340085
-2017695895
320972945
-2092803349
-1700341382
277476993
-265537613
1063455185
-1659853917
56571678
2049509808
1499129098
2139946962
1286593314
666496706
1056667298
-490419648
-1509942104
-1300250000
742279082
-1098105866
1870702220
-1628759413
-1139932833
517122548
-1627145920
2082981676
444825509
290867140
1656608488
770810589
75703397
-204770059
1649230065
-128255036
1271101671
1321193614
1301456190
1674758354
-1568957011
-1744667106
757583335
475153056
-580529095
-1384857256
-789421965
215782301
294425000
1723423981
1865542645
-763393511
1427594448
-757770713
-1338290920
901287609
-1549234918
719062779
-1935327033
-991061744
-1619453877
2086743268
173970488
-196999644
698849972
-610995992
46940092
-561371728
-23120227
-1542085576
-755942504
1135940727
1641697189
-236540579
-75108665
1715089696
1391870018
-91730319
1827747653
2032803467
-354528235
-1163810613
209131122
-1659289928
242362539
607404031
71477981
883501574
-2006545862
2040262629
1965063513
1120405509
-1177176104
502585163
-1153242636
605860311
613182358
961316260
1325321891
-974765922
-677210923
233640911
-1475642371
1299410467
-144954152
-1040451641
1778302321
-60135479
16731006
-959547943
-1710082848
943124107
1444212476
-638623214
-513792454
-1474351226
673388781
1826319288
1465402467
706409583
855634406
163059112
1161626048
1445674846
-1216760177
-687029215
679622086
1893204297
1273698489
1907505640
36632630
-32790009
343413049
1638999915
-31987490
947712872
1410305803
-309262719
-245478833
-999119098
581341435
-1708110345
-1929687881
-1487009572
-258322637
161763274
2094928351
-1741943313
-65586053
-1790980291
-1380149847
-877951386
-448454234
583404093
1436927918
1076150268
1723271633
-603983760
-347100350
1350650302
907368867
1515405292
-806217645
2045446465
-1136791549
1344347690
583785829
-180860993
66277424
460950554
2133426906
986485590
326840370
-1041706618
738350986
-304947964
742342101
1280240474
1635221715
698085685
-1484680183
-1222339598
2009149423
664747096
1978726128
937144364
1374088569
-105134809
409662014
647331858
-1045880655
1811204252
39464663
2114353055
919800730
83632815
-159588724
-682414033
-888660234
428310349
-774750309
-726669709
367205534
618509660
148327043
-2059475492
-713614492
-568565587
-314488330
-152922377
2044843043
197212825
-908444172
186113806
-1095209367
-190086376
-1271135153
1928468624
-1574503298
550395622
900339812
778427971
1343883152
-1570726377
695139693
-774433296
-938438796
689946790
2063046636
-1461104944
1000768919
256631077
-569196323
-726831280
-1386223243
999063014
-1107132270
-416244694
-1464074891
-2041172730
1704726335
612905651
-370180214
84209283
1781214504
-629020563
-1469636228
857899373
453828041
-2053628979
1435803685
1853024818
-1614941428
-1308232415
1417494307
-1259183807
38854196
1894700707
765508543
1533263090
-1447948701
1164197983
-1004897195
1444619582
-1644525207
699147109
202858685
401947928
559100307
692087370
-130822939
869750174
-587972556
-1783044187
-790616879
-968274072
2113290460
1518661514
1559076348
418985244
-162141130
-1445627332
-1187712361
1124066142
1365237667
-975971880
1408751356
-190215861
-1627763585
-1667253070
978868060
377023530
857219349
-1870587119
-1733989996
423374343
500699217
1794140533
-1965865789
668762185
515072320
1133279997
1643633590
-1922210832
1190359634
-1619994453
-1772006574
728452985
1096954009
-2114236686
719202223
887140754
-513629852
-2091182889
1336798709
-2117363459
-1634501092
-1239170555
-1420558202
1261268962
-1390429926
149832636
2129027898
-1758983533
-764429404
1147186071
2048030490
-2134500512
1671805993
-268018683
1117486368
-1941311899
-1271383244
-109751630
1293041194
1142958796
5504861
619297178
1314704270
1753476839
-746709547
-1137184708
-1531323359
-742665036
1682928686
1122615346
-234870698
-160911481
-1484371099
-442335981
1566633471
-398439971
223040595
1259210357
945164998
939870844
2038110756
-1802022929
1850377427
-581811076
-35820551
848206173
2035743612
-709496295
-1011762464
1060741446
1244687742
1453299901
-451639006
898792356
-1735366641
-1902382409
-1054412175
648500932
-1869290155
-2036559822
1677463760
-1944481589
-250068736
-100040515
-28682754
1492580674
319928633
-725126343
-337237936
1924782644
-1966141055
1060275684
1383532528
-812229432
-1313031720
-1287426788
-404345830
1153266832
-430409369
-1312551912
-886062390
1635899136
769300907
996178620
-432540639
789763825
-1021817452
-694232302
-1300372283
2122279988
-1112132424
-1153352253
-2049396526
449296689
-1653582785
-1106049745
-1979456072
-516715986
-784594106
-1404914683
-1764634155
428035659
1843895656
-1644051537
770251015
2125061386
1048440620
-1864515173
-845159724
-664461103
-452955303
-1257350821
-583900857
2130924967
343622341
-1072603362
-587882040
1218547746
-1885961453
1658177825
-37304067
-675593382
-1200863180
486125990
-1579010653
472686888
-1556732515
-2018855762
-1642118839
1684721906
630744465
1540939296
-1563275075
453038801
1962415256
1569174910
-986265783
62951507
-1092346624
1461425696
692602721
-1038851723
-711627978
-921848572
-2046073959
-150674608
301559684
-1466345380
758816518
1616990586
1470921581
1945408905
-989088751
1538577910
1008335951
-1093710539
-518513455
1373752804
-1873848920
-876685262
-414288104
1196472461
256903534
-2143541458
1309725184
1072367212
-1277753814
794384082
1253135302
-1906434987
696638133
351181178
686360426
874445955
-1366537234
2077717589
-1185076021
335740727
-901039445
343556056
37284494
341881547
-418414815
-1352697449
-1443249035
-353676159
473019442
453167757
-586398678
-665712327
-446134673
1125417151
481434402
-2130120276
-610391169
-1166444918
250639777
1688404448
2005101101
1570222178
724200232
-1886105293
-1672988585
-1575436969
899720099
408226927
1311693249
-789456058
1923166417
52744263
-1475732488
1711718242
-2033744529
-93948949
-1661125543
1871079234
-1472687407
1312159215
-964847134
960388005
-505195818
1123029381
-743244411
127776421
-1022613924
-524267409
-442591813
451185277
1233230152
569516403
503762541
1395240138
300916459
-1109902783
252263833
1126237992
367278087
1347846416
-1101395670
1754163088
1916089960
-1696204153
1340386336
-1249458767
1356320527
555755685
-1982147202
-4843280
-888584614
1867255450
-1050100556
491556014
588380918
-758191914
-383892503
238916588
-283844883
-2080367085
-710589435
1292797639
-1292091357
1896650250
-811964783
-1820854984
660126254
945485973
-1701439492
-1896654884
-1007524818
996484815
-958189649
1822869395
-1599769596
1424104221
1202891405
-179643643
-644502008
-674866871
747510656
565411694
1387907049
-533565610
-671792509
-1065383035
2013768625
-628096108
1881085772
1832215602
-2076301971
1632271523
-1564473925
921194845
1672195312
741310587
-782297066
-515881850
-109949524
-1544755480
-1208087093
-397175875
-421666232
234121765
1933887115
371575232
1885981841
1369933778
-981474831
288340676
-1238058343
-406122101
1361530787
1366195704
-539282254
877359907
1672312722
-198315300
862020624
-925059053
-369040321
1011244071
603065900
-299333980
1263490811
51868957
-1963641624
-382192076
-645021679
2144123245
972478023
-492368631
-627422390
-970398021
456360584
-44003071
1456162101
68136868
1359806684
577200394
553995559
-779954023
-1310892525
579923289
608892906
447208728
1134972894
1378683466
-151915120
-647729576
1883516514
1449420400
-2236051
156461212
145247858
-273705556
1097103192
-1146233558
1195671695
1262260640
1880801678
371026449
-1435859334
1172461104
1595049744
771266500
-928874125
-879181783
143927082
276142473
1233226805
-2133295888
377028735
-1105132914
1528741090
109790343
1566581433
1315874202
-1957612546
-128570639
1008609636
-1111654371
-980920036
16481060
-1194545635
1982995420
-202500112
-912504632
-731301488
867604142
-614852360
1903093178
-1592466194
-110287749
-453176158
-775191324
-1658887389
1872530719
-1627918826
-608413675
662585831
-1241737560
1431319306
1856242541
1478274161
-2144239531
1568033185
-1100572908
-1807104294
694871414
-973049819
377841800
1836013866
883549927
1091714891
-1435459509
1837503010
-1159593355
-417406647
1809298286
1836396877
-303482437
-131108252
474066874
1953275870
-1402374964
-1932001517
-1837374486
-1431457618
2144096739
69000452
-809177248
1852390064
-1712540022
-1390518621
-498042996
-2140152284
1087141794
1272709856
-11727092
1737549994
1152203321
-1961182112
376669074
-1666866973
480930168
335199502
1678334883
1531133221
-1275631163
1368693006
633001861
1382671097
1181815294
1942749498
2086773453
1424365650
-698127256
-54796641
1008166064
-1761850147
-1185129850
1456480703
-1869985914
-1416137117
-68028423
-43492075
977884705
1568435342
1870219077
2145213476
-807973657
-1248914579
1113700907
-1509364262
1765731463
-879530291
2085685897
-944777282
336016124
-1780763549
-2037960509
1161687271
2102783101
1819642812
-734645190
-778154583
-1912448954
1077675545
356078166
1275574866
-589142
-1265208788
-1606345243
175588302
1750051980
-1436453971
451452352
1350734269
1438670933
1547290230
1613673819
-1974442490
2005930049
249759098
-302669771
873296879
1365699050
1238828724
-606931998
1484865448
292061792
-1049590304
-97687866
512531505
173065905
34838460
1870526647
-1148777090
-232656747
-2053904342
757699391
-1419148898
840624274
26366043
1600675378
-1318195060
-1674555521
250240014
2049051996
-5517489
-17712851
977527302
-1768505067
1874718232
-1472379469
-1655910604
1020223082
1016067586
-1929602576
-594115449
1701669642
-221155077
-1936792589
-1452925998
1092966450
484708949
-2122684752
2114993163
1550654835
1381673217
-1826950376
392852771
-2068380800
-1131572883
108418486
-1390726181
1618214095
1028800612
494918498
1190565777
-1943147509
-802652656
-2088660143
1337617372
-500575194
-352327725
126211807
-349518545
1560686544
569732691
1969239384
1035945783
2139693606
-1820028904
-1575497359
1515238160
1473695124
-1992573830
-481322840
998901432
-68438754
-1566980290
-936428014
-1869845234
-147330326
1708675564
-548760981
1731632945
-1992631538
1613672183
-903402390
-1356143335
508516038
-843083300
-1259210558
-311137861
377171066
1659454600
-1909055933
1150860962
1125254172
-2145154119
-1575538014
1739063696
-1510336653
1652321839
569328331
-28823858
1340908655
-1995793739
1207262812
654225737
2079977549
2017671782
720352378
242878743
1379487872
-908005320
-548325087
-1948669252
700329661
215131231
-435155446
1752127680
-1981909620
1448500097
-1354372545
-888433535
-384229095
-402361035
-350340982
1112140010
-1307790030
710026968
922863212
-1906450192
-1885030190
1585802093
-360232002
1642793319
529299463
-1118429728
674206915
-259654905
1487162200
-27620002
-1651773003
480115754
-1896608524
862604841
1540135921
739997740
-1788226126
1288071631
1187159829
637235206
1333277015
-1848807382
1976946289
214987988
563916690
1176656819
1208460308
-1262038144
-445235382
1252872470
-1475605394
1817841180
-748340304
1135635260
2098565315
-2111833195
-413433414
-503501138
-513833147
-1208635193
-1923562122
889158321
2023562426
-732196408
1397243992
-1699138540
-1114570611
-1102457208
289905133
549212151
-982802590
1521442185
-1556556592
-1198443962
800203629
156729788
888392550
-1851557894
584921966
-720393321
1006431062
-1496497988
945700205
1588884888
235980986
1816620968
57288085
1614930415
-1807553642
-313650988
-1006056150
961459350
-1793363977
-1250669895
-730927054
-2114971068
-208096252
-276835437
839075168
-962534302
-525825328
2036832600
-1177403954
1237898156
1434539768
2080860374
-1056756320
-1791029333
-1125192697
-496786154
334425372
-1222911610
1487363924
923287040
-1289621511
-1621116647
1397175855
2020080620
686017973
1081888718
-489297176
1879341019
-2039133968
726832729
-1044391737
578864633
950363185
401608863
-1727488879
827018350
-1722390150
-2107548155
1879398790
1939100350
-1536464849
1380360284
2106195778
-292957029
-1319643593
-924731759
1632430735
1759949571
-557166247
1331981819
1851365276
-611172259
-652564567
-1916361418
2014506967
-652326059
-576953439
-1939033617
1847267344
961356428
482641291
1961663489
1392957664
-335917720
-1736217498
1918895458
1663787109
1974470460
1764158651
-1573560315
-1336510519
-1161013145
1497739692
367720212
1199619880
-2027715738
-1340285115
-1285538990
-1333676974
1407094382
-1516224996
-1563368693
1269515452
1091303774
-1105504386
1086721349
69806413
1653332551
1384968863
1300261791
-1374382789
-1554839690
816224036
191053285
1798291229
-374091535
-1154132109
793131308
-68831356
-1218620618
-734953100
1854100136
-1598239291
1585726631
1658728386
-1313297180
-611307530
-1970849815
-1630972635
1084696764
864674271
1532652764
-1932764790
1900200764
-2091991981
-2051599588
-1829945336
-634557686
-2083898451
1204088951
-105531644
572956377
901370952
868259744
1263015933
-2101650122
1205041607
-481939866
261742644
-1437056400
-676182798
-1359405551
-1963247401
1776896679
-1412400584
113467100
-83499936
1569109569
-707352211
819971481
679617917
1847172741
-80863309
-916746606
-503478334
1443110748
-491762888
1208157873
-933243264
1239821607
899899272
-256842486
-2145327813
-802732240
300212259
-784283011
-365394027
-139328585
1971834911
-714299562
-1169834342
-1197954784
-1350033278
2000892333
1294551119
632618334
2003395043
979500188
2085606140
1289446213
1200449821
1710400887
1294259391
954905557
-1975299170
1750883430
-1824459093
2019018434
-1800615646
-314457992
-316004543
-556167724
1149481975
-1113143277
1514016136
759626514
273175102
2058908507
763364751
-56382405
319915371
1192628889
1437820726
-543648288
821363211
-618397267
1897486349
-608927384
86424677
1986000381
1800567577
-1813025772
-1161137872
-1922747862
-1373991734
1421673606
-1381803055
-68594622
194431838
-1566325197
1673221853
2114774158
-5440738
1911849663
-1921316141
-42920714
-1831611552
1820628614
-1831642302
-534155900
-941165581
-1810868357
-1309809157
-1470050322
-1625772922
-2011688549
159416166
-1347081605
-1251603278
781570104
1386478442
384226439
812410246
-490168613
178804193
80841086
2002493402
-1878171026
1330653244
1980400350
-1355914125
1120907636
-1584178989
-1300017099
1772555724
-634761778
-167928672
-1223868187
-1908579661
1034343423
1995613621
-539823710
18678057
384041516
-337181793
1457848455
1553680508
-1331634146
1726307857
670709565
1867925576
994998531
1004197463
-1960235338
1660088793
-533694631
740704739
-191779343
-211684106
997659880
207925659
-176050777
781924553
-1235744887
-1960967274
-734090986
604690713
-1258038658
110993361
466424506
-564645316
-1694470652
-853826347
-1001243391
45540027
1643482641
436064016
-1423490775
-793295913
1563957397
-252797966
2042028533
1315985097
1879488146
611781318
-1418975653
-1191095449
2123880124
-509694969
818615809
-817393245
1331167957
-1498624289
973841272
-921594236
-1301536275
-1860091792
-1783111776
484759936
328104767
160172513
-673114038
-728975773
-1462187841
-819845503
-717970587
-532599822
-1853676449
247407209
-1553321489
-364161931
1792714860
646548845
-2077042999
-353657119
-1915468591
131939310
-845724370
663111161
2034083361
1809404444
-607691891
214230036
1474833608
532181465
-1782551641
-1207175987
-692773501
-2014408657
1368959597
597409552
1011387861
-1081581314
339246281
1044177754
-1668568320
1068957327
-1187528863
1683363553
-166114157
1936596480
-2691116
-1614368023
-1969657671
-1355720710
551805606
421875340
1778200269
1362895128
893461252
187418683
-991461361
-724358718
1047668791
-966093022
1306546440
392315479
1289019949
-632557834
-1684146159
990796154
2009461776
-138692047
1693857725
-1483571024
1028615042
-717278335
164471641
1474983855
7495827
-1997672107
1736637888
-1146061964
493388791
1276240293
1228526568
-962956812
-281612194
706191911
-1191421243
2046558355
-1786384872
-1375708325
-1502903997
1171820468
-1715803831
417425316
870942712
2047310056
-816556355
586139103
1929375705
-303998385
-950403165
-454020917
-678569260
-1607509508
2143394685
2092301082
939511928
-1787742296
-255080467
-800894083
1728520657
-1970423258
1837931875
-1145174205
1562451359
1010355419
-985774402
-1885858366
1091365216
-105257726
-1143285024
2042214244
-1309507281
446714285
-1355449808
1075488035
-1706770200
-534653262
-559908698
2145612233
1663628259
-1256395893
1244669408
91379740
2046264976
1503113619
-956909829
521917936
-1419727437
994872516
415003221
-1480745632
-1932597245
-523546387
-1952590121
-909705538
-622501986
742486773
1664528790
484825987
-1301785218
-586836792
1858120923
1341559320
-1273409070
100104775
-2037152584
-1387019802
1440280621
-2107335191
-1147134941
9339495
-360365793
193264873
-1176498382
-956371144
1468467193
-677867819
1608527762
-405341255
-1299413416
-123129132
1917778465
240073113
-1001410703
-223968592
1468487104
1382266830
727935734
-147093633
178806305
1177029750
546201323
1777593944
-265209352
-1399746741
-452000130
-1408115803
652473991
-1730613930
43464180
317416097
-537158637
931254564
-688745087
-1569862238
-1761688971
1733714485
-1285561348
-829175964
-1415349282
-532382611
-714847826
-910782616
583697096
1899870125
1822096303
1536066095
292614301
-1932502663
-811355358
-326930887
-1329816164
30158368
1373734231
555993256
286565183
-1552852100
-2073862886
-1918984510
2049004762
-1415460954
1546002330
191127122
-910876917
-1363784628
-1939260739
-403788880
-1783736063
-2044122123
-1635339308
334587490
360500166
-742748324
1618099368
-1964693809
178893218
986758917
-439284844
-429234764
267631067
135662996
-1449758071
566513450
1689806761
-1506122377
-1023494499
-1513247827
-514107337
1825752594
857621761
476711264
-1932040938
1076176529
243554170
1989869030
-392992027
-460308058
-1196020242
1570574207
-2095702753
-1659671512
1756494543
1596481513
-2039409254
-1103552359
965566939
-1835281338
133397808
-206210828
-302257012
34699965
1223326549
836311604
1436314402
-1283427750
605521348
-926418176
-2074354082
-50996605
1247731619
-922443921
2033604966
607535016
-128914710
2007037028
-539750935
-186955140
-81464708
-425519156
-787916162
-1354704715
460775390
-1660169239
-1852461032
1620089396
2042371147
745661000
982184430
-824663511
-468124474
1966931441
853428379
-798313996
1103142180
2020320301
-2054622759
-1790263258
318171916
1803762830
-1850704
-2014732847
-1652839058
-839376310
-1128896150
-94909488
-1739377580
1289305238
208940064
873504945
-167442871
-757800771
1513476634
544130995
-587412491
1344507822
1520894829
-1867484212
-443186673
821406762
-1087151767
1831906035
-2117677730
-740677313
839087296
679226814
-556172252
2096156514
1667626002
-2054265936
-103701397
-1196677590
585513844
-622008134
937702174
442441895
1201803233
-1074793571
-725716278
676346942
1163385398
-1231838118
-1984201570
-900481950
-1005654317
-1369466052
965578404
-472452762
-1415648293
616960283
-1393418777
-679701357
-2015475326
1404248938
-1240129400
2134137497
-767964100
-471494767
2024524351
1597985714
520485493
1277330283
-820409502
-245548913
1726797586
-569422914
-2055200088
150938810
-1424282540
964948670
346879724
880035301
-2057720341
1367552123
-1915066548
188929471
-406656369
-1041496883
290209129
-17820380
1611914650
-1827792925
1113714584
1975850466
2096010456
2037120280
2108734610
-1989221062
-449930895
-1983566032
-790210588
1787469477
-420987819
2060491520
709352809
686611134
859658603
1969804205
1775109556
704862775
1858136964
-836083641
1256728682
1222792348
-2119645443
572129731
-1090392253
1311134577
-712282046
1112131807
368070674
1847308465
716667921
-1953165782
-1145566044
-1835024386
1354040332
-1973454389
1151256139
17452000
-1025954672
-1470902210
-2070104
1561792909
-30923501
1506323534
-1952180162
962121267
-708591606
-1769799493
1203379167
-1971572822
216941768
36495286
1522514987
-1233993996
2097083895
1563405072
1032884214
-1321032734
-277339461
1765800650
1649268050
1904211769
1545578257
-1168025068
612699590
-1901418601
-1249211990
1818140576
166838933
1303925892
-384206496
-1403209517
953870942
-877355122
-1907975252
848460312
1959692468
-213527504
638518524
-1786389467
-325238208
-204662573
1157744808
-1857106100
314460852
1268735981
-1744044760
1221878333
-1624683703
-1521692709
1203545034
-1437382657
-1850312750
-1385433467
-830564835
657987812
-1762839736
-2039425587
1813591087
-2006919483
73701473
570143835
-326847748
543475990
494459553
-1094223702
1777447263
68641753
-1602424842
-795276585
752713828
165866750
-1122324197
-552704703
-1906492930
-1462085569
127256902
-842218610
-742360062
-1799543504
-932697998
-533028476
-1236968992
-870175097
1412082726
-1830363662
-731094408
478432256
1496609475
-138632494
483375625
814479220
1240358990
1754009928
1629072875
1753256979
-87625621
1850788389
913611670
-1961681778
-269291552
939640976
278546657
1747261865
-1589060144
-958023296
-1267053268
2002369647
-945228507
1821847587
-1855279933
196061134
660028387
1064473679
-1713760104
1620138085
-320701609
973479824
851017183
-189932944
15593173
-1090457537
-1121708801
1039382185
-2109880409
-407795283
620930741
637009851
-1387020449
-128492845
502113665
1429039301
-207140907
2006476787
-1531389303
-517152618
576839927
-855545124
306112051
1748255518
2138665606
-1001212440
-792540805
-1907319813
-817019778
1200708900
-786172759
-1585444416
-1631499451
131326799
2098027878
1446362517
1737500552
-14815248
1639342821
63242426
868534840
-1053269976
-1115481466
-1331829183
-277598934
373150221
404571553
-1620026395
-2084225946
-2094537505
1170964224
979096650
-1104816675
780122923
2014039394
1112435689
-255227838
-1234013233
1564533328
1815858593
-1193714533
-368617782
2147101312
-2000365138
65346595
1620898935
-215943370
1009874152
2079070023
1551420905
-311244337
2033677149
-26582399
958352777
1247884612
-837766332
-1705521708
-1316306565
1735252692
758186838
-1479878698
1521752240
1133861554
-491382591
360833283
-1435776782
-137010919
195830473
716777457
239253161
-253864152
258912231
1980051858
707511718
-2088329225
1836593933
1960556271
170278680
-166880068
50324066
-625793247
1505632502
-37584505
-1033244945
-724614035
943492785
-652309102
1008846905
1972790288
-1728333661
-2069688913
1779420481
1524771995
1369811039
1201953108
-1452108552
-1250837793
1300020144
-1114744893
746644134
-140033734
-841828754
-1484907830
-1420568345
59887305
700143110
1780894516
-1874283793
185011446
1836325567
-1383033276
575047014
-1544355039
-569967795
1789727768
2082866827
556099822
-259573705
-1598042785
351897013
-1369613079
-1761188022
54835321
1425719298
-1656130269
-2042241400
1682149983
-921919774
-353759936
-134762356
1397288700
-429745014
-915460144
65721346
1334365874
-2056069957
-1774315982
31109393
-518985783
-2052819459
174170373
296825511
-1164211043
2086278091
994474190
877069262
1881308958
-1429847373
-2117458504
1650188757
987961923
1362027778
1130550073
1060031866
412096102
1624185845
543698031
-1540588939
835235865
-2135757515
721717416
28146487
-2068107469
56362920
122527579
-1605421590
-1772992482
1266199112
644000389
-695797177
1719351430
121298042
-1610488869
-1742509126
221020188
51029282
232053536
-1107036283
1851798753
-1868787577
-1808616500
-1055067405
-1710952757
2129337936
-1895505027
834007746
720295524
-277880807
-216289987
143070687
1273595881
-2116390524
1693308437
-1240600811
-136987807
-1321837092
-1406436675
-1378082967
-1509925216
-780322992
-914672910
675212148
-783845790
564767777
-594045564
-1670394977
-2007414490
-1341883048
-1861899925
-1189285520
1075698926
-1948798729
920428368
978973107
-1772153651
-779676185
390856209
-279058993
281883658
701120272
802757124
-876239837
-1020780709
-1298898484
474680076
2127233337
-346368497
-2137011542
1918899218
-261094712
-1911430021
1985063546
-1760790973
-1653215336
1002608036
103361641
431538729
153754660
-382840688
810401363
-223432068
412757077
894716427
808090129
-1638974116
-1880462332
96484167
-1503178209
1985902239
1923969215
-1572913286
-13784441
845957171
480857264
266554193
959273323
-1728503484
560567908
1713718461
1219763360
-218974233
485170748
1869363846
-336436536
1939282313
45060309
1268696630
376148382
2141782136
-1001964340
625613398
-310214184
1349909577
-1782498881
1871491626
591617763
1547826539
-28638068
-1841049785
-2087713646
1895328829
1532359131
-1755087921
714623619
-784169389
1115073661
-1823698477
1724625831
-366260921
-536251089
588376127
-2042020202
-1342440891
634240591
-1197708135
-1473365596
-884151333
1651793935
1294145316
-90527926
1601695103
-1951559614
-1697444870
1751557589
-27997378
97682210
642409340
-1642816909
-1121637313
-25604641
-1507188808
851178075
334157189
-1351792650
-1124840537
860408373
1412551332
1084128439
-1689550749
247621997
-1223210715
-1269201962
-2016949101
-1752386862
-1124303181
-1155494567
52623520
828219326
-1393890325
-624412079
-1774295562
-1693263492
-1132977220
-906276635
-805230314
-1322037441
-1391737173
-2126367626
709744247
702703002
1213749864
-166888934
1077798422
-1876344942
-478596687
-1027903361
-1878955693
1959112006
-1752295677
-668892878
-2032585451
1470596879
2079516227
835928255
-1580218957
-1233219755
2037089511
1212334014
-619575585
1798493523
-1054738036
-551095357
-125705228
37206480
1230768131
515723008
-336467823
719133617
94440454
735449800
-105864751
1500128422
1009840252
183745252
155108194
1745751549
-303401814
-1338856599
992324411
367346091
1969966475
1403835546
-1854993890
65489966
1894231737
-2080551738
1620762135
436100889
85390895
207179857
-630895023
372394133
1944304938
-1530022424
-618910048
-167958856
1352008525
-1517500931
-1984988511
-633270500
1881897900
-1932825146
1302331004
-1767322935
1116669128
-1768987072
-1003570641
1077011794
-20863153
-1982356177
2092366946
-815955051
-1286637076
-446990111
66879056
-429835214
12062303
-720074507
748297490
-2057216134
-1830216692
1893260605
-1715041618
917002314
1021298378
2086263220
-473029518
-2020929122
729313059
1881878213
-1244056028
-1302091194
-1949641817
428300430
1497140636
1201335996
-1758801338
-1304317500
-59207632
-1036878333
28594058
-2000967440
-1572350851
550878318
-1409708148
1525911654
-1889171189
-1541903049
770128080
-619207346
1675947795
-960714863
1716373325
-905244311
-817906572
-217281678
-740016820
-148784270
1247105999
-1624147307
-1271946310
-1572588525
-133913233
438883389
-996010303
16373507
-513198114
941402811
-1197638361
-847637531
1921977568
1315221985
1726208465
17420972
-2117319861
472979554
728155242
-1628762284
-48088777
316708079
1018961996
1091631941
653699671
-1320825834
-1120583895
1938336290
-778861897
1739733665
2147379446
1347306342
59586813
1891229566
-133498694
335858423
445299904
-1825180349
891016779
95117593
-1281688864
1153618803
-1177240648
-1110604511
-376917941
-1999925517
887732080
-14995049
-2049541245
-689360863
-339374194
1957315003
-884135839
717251371
975915751
1584642692
-184669936
227874675
-1695453754
-1387881843
-1148997207
2043895310
453264341
1938035036
878945305
1594320202
68711838
100854960
-201141255
-751251230
-1972024319
-1154114012
-737534444
-341673769
-573535176
1269545255
-233638447
-1242290449
-14329999
692028146
-1987469030
1998456750
554913879
270083719
1674887670
-1279473502
-1858641353
1914404988
-1163790794
256651064
1543003255
-1497676606
118745207
-463166783
2135053991
1880084357
-1246094461
1713627299
-696943495
-1785583922
1986621827
778329247
-154410959
-1061437553
412877270
72168828
-1616953768
42934948
1467009574
213572948
-1329937462
-514665464
-783466571
-438935723
1646190080
-667799604
-1342160243
1599990663
1288236970
-1642441599
447234321
1521598119
-1235360304
-1827630112
251162980
-222056673
1499790198
1625030025
-2075230398
1695141731
-493351128
-525852188
696988981
-1810248715
337493497
1817845374
1523068677
1449858725
-1449085656
-1131075481
272681429
1386955393
514731380
1097128524
1165473979
-91432255
534986533
838534607
-960638846
-334876196
398839329
267827109
666531295
538503505
-495336529
161945239
-29589612
394582319
1876910009
-356689678
-482399547
929178940
-1697989631
1814950662
2009046547
-387279835
2062599031
-2001198470
-1506941670
-197797247
1213991217
-1854775496
1741872088
-1029138152
1116189131
745551762
-677634633
-20663611
-52036673
-27190539
1427133117
-1089917501
220699009
-1879170742
1615725028
-1692236630
-1128720930
1775642964
1335140591
663432528
1217591266
2057023429
-371738814
458088484
-1514124916
416001785
-1567737807
-1603675500
-1143796853
723299195
-495720015
-98568092
1781297486
1448736585
-1898808368
792067351
1728537666
-538089350
1511339263
1352883667
936143612
-2074216780
153090965
1552115190
1022286791
-1771607029
-612669605
847466225
1821738405
-2120708631
396051781
-1940055114
321358170
2001450964
1489751187
1739824875
-1956125279
706017155
1395575728
-1925114962
123393064
1160125439
-2122655217
1034290762
-986242495
-897704785
946658728
242397106
863112110
1900468411
493174829
-742016122
-1924456136
-721056740
1013378160
-295474720
1720041063
1111269039
1609652760
-1170926499
-850062501
-1347223827
359936917
1256778826
1161695898
1241777571
-1950129439
1009008980
-514408139
829006552
257574081
-974566145
259759198
-1298505009
-768392245
-876013317
628542026
1257789145
1383051414
-412450694
1400846309
92410615
1921658611
-949967162
741084172
1477332903
-1504706653
1621010555
-1788977274
390727652
1591299934
-897157562
548094128
-1394400171
-2048669508
-1391243967
1639239591
-1731038651
-778198874
526457503
-1725689202
-2005288833
762360552
-1513449616
-230327836
-1455020461
1312691284
-479672651
1286029846
-1704048341
-2075977416
1246417829
490719548
-853463644
-594697816
2065750817
861591504
351748311
130054321
1261347042
-804464893
1811707197
1939668308
2074352241
-17000249
430760975
-74499759
387564982
1918678490
-312384139
1782401966
-421056202
2087737892
1389779028
729636326
-1136897414
-1006519819
-518542725
-94672729
1200666685
-2078165430
-143332404
864597566
-1060144062
-807386903
1285220795
2083089181
783228365
-869148598
244979912
1027829407
-1643150369
300719928
-549729949
1949293432
1853390320
1641666754
-642968625
1202814241
-840762025
2005071232
-142741576
941387779
1242803659
814269662
982921409
-75404793
479718005
-421992126
453468670
1910060031
2039379023
175180844
-1392962741
415073844
-1027552830
1363609846
923524591
-2036012738
-775991783
-1136304302
-315935899
746690775
-1699757828
1520101467
867030500
-1487084731
-1952885587
-187954718
-1224042728
963214881
847311600
1975127814
-875243901
-2085765850
-432805649
-966150201
822625451
1593546444
-228824248
-877250747
-484733284
-1933463628
-135846509
-884805415
-586994157
-519901717
-1728816968
-802104351
-1814042434
-1454185254
-82767294
223068689
705018350
-1950133228
368276875
-1265033479
-817709325
-670801531
-871676262
-1376241608
63192746
815431454
483271846
-1135034965
48581660
636686103
-1446843612
126500706
-1223674684
-1205215620
1599185342
-303398544
1042230906
287990488
-1077219399
1190764290
1331586332
-1089374287
-2116052103
-1574258538
-1237250648
-1400809855
-844163602
405518684
629204869
-2068879762
-916430179
-1835697024
1643203294
-16328875
-71187341
-1691095957
-1186648680
-752699734
2125791290
1055714567
-1616312755
-720491983
-1580485365
370681448
-197456338
353694832
941220755
1885337861
-768241043
-910793900
-883328994
1832470335
632891514
-1659474925
-924176589
1320328374
-187047830
1585799059
1708084261
746888124
-99852912
-1334451221
1935838003
111407566
1293170841
764525196
-2114369070
175954848
-406409409
472376237
-1363934836
587200224
-918920447
-1247256898
-400171933
2068201176
-1883857388
1254311902
1306642623
-2057163804
-753282947
336992671
1303848729
146397105
-2146363048
-1477029724
-1579445719
-979188167
-529588679
2019336999
-1448646186
403078655
706277859
1417629987
-1394793642
-1921985851
373089379
-1358781967
1801759271
-1474536132
1017510635
-467364084
1069667964
-1326989269
-1592912704
-1105181642
-2086629640
218690452
-1371423450
-235100384
-2091495783
-3710250
517517757
1670293121
-526843977
-865437379
-49236154
2086151794
633820053
1455315628
-1382496068
855409294
1109388328
1571783532
41943401
38452525
1288191023
1176534048
320087416
1912429986
-1461925968
1973083579
-1236589361
-690012050
-646213555
-345812595
-1490856415
524729387
-849024842
-527269150
-262644435
-2047353376
-970224424
1154947749
814162852
-435665406
-106168652
1551211217
676714349
1139180643
1831160933
500816611
1651047199
-1191562476
1704883476
1145754393
-1170083805
767582214
-326602941
1695481458
-1148561949
575188456
770289954
1198805699
1496010035
1590163852
-134243310
-429881242
181067437
58693312
-747622505
-1487184692
-899841687
-839399053
-1707606045
1855742036
1399052863
781733559
828282929
2091769890
760106714
-906170280
2086794346
1586833444
1545931618
168296165
1960485161
-1545196727
540068872
-184634438
-115938045
1812254091
2123338537
425132650
1706547756
910409180
1279220865
-1731509006
-1638986493
-2011845042
9845622
-584876626
-694166187
36762948
465678195
-92658859
66599368
1073431042
1397970809
1947150783
1749851779
1804835445
425618005
-2093860873
-1672696809
1336509300
930752864
1886632218
-240928282
1633796396
549093256
-684845335
-675626450
1311746918
1607476709
-469875278
1671471520
-531989503
-1728149879
-1186154701
992554648
-2095363497
-1945193265
1226066507
280700253
1895739324
-2041925420
1736279343
1567273394
1424212913
1610659265
-225251579
-677826944
1920781435
-166454075
-929858609
942481404
1375912935
1836910867
-1880117241
101267739
1758939773
1114487486
-1036792905
-200286824
-1548072867
-817868938
1278990833
2106939903
-1026835711
-1702202248
2009739316
-169849793
1721978325
-1204334222
-1549849517
1516657694
-1108242860
-67531220
1392196527
1986429010
1158810061
-1143868635
-1641380570
1324767908
15993929
1625557338
-587677883
-1361877008
338083305
696146761
1660593716
-816338956
827644656
-143034498
1673154416
506131453
-750708364
72248079
-854808869
-1605351198
699926548
2006890262
-577676437
-350427993
1319990695
-1497355414
1846550900
-948423903
1086901559
353374923
134994573
-464127616
-2130008767
1047011851
136087939
-1079538578
379957231
854273490
520729910
747812879
1312433450
1172984661
12162244
1470291866
-133372292
-283376727
-1579241987
-1706193127
-1457238816
1879573520
50355245
1219429606
327574602
-1593710596
2106035937
1309441013
-831808311
1364404318
-1958177037
2144624170
1069671867
-479284391
-1224850850
505909058
1632524965
-1750178536
-639468238
-2114717551
-1518042943
-93628898
1603134032
1173892318
382193130
364659802
1674343043
1461822020
-1857798333
-1175861533
1725605734
-1932400507
-1876305489
421278981
168869319
217336947
-494901762
23067304
-927603085
991080067
939758284
-1293295425
-1241112439
578773885
74616866
-989794705
412117934
-1448420893
1251557480
1362055380
1121548838
-1804739447
-100978824
2053902150
1308916481
1598334458
1796289166
228364907
777644443
103934971
-130745906
387628979
-618770901
1128827415
12142132
-1543919296
-365270379
396409484
1765446462
2021357415
-644078641
-859532047
35818473
-597412909
2052239999
1429180343
2044219791
827758984
-772943365
-546140715
856170874
1988515823
1990864812
-96509812
743692118
-1181605909
-1191461061
1966960798
-1232739934
1527059570
794620496
-210911173
1477506013
-476148208
-1323147649
-613301393
-712823752
-1587386321
796351262
-1732036222
-1205976237
1529231000
1208721991
-2111727745
-1880012105
-1539608004
588863079
-603652044
-1467395715
-1786640561
-1394705891
-1633072384
32290606
-1677792186
2031730776
-585233972
-846459478
-1634777747
-1326840411
-1997174219
-8617121
1748954470
-1867464998
1823962744
-588298161
1598945240
952463437
108746936
400025970
232154608
-1415661060
2127706006
1825524095
1421686787
1914803777
-769131783
-2020629795
-2008303464
-230429544
1726487682
695930468
2047296454
1176806047
-1246842035
595168141
-573249422
-1873460683
455877179
1114119689
-820254540
882365016
920591228
1487131855
-534267648
-1861778822
917281396
1387398358
-1548405326
-1161848956
2086525243
1159667903
32059967
1978945580
1610044111
778380000
-1466169822
1256300948
-992306635
-775807708
413272064
201722248
-316884966
114742805
357196562
817607895
784713999
-203933696
-692253818
232391858
1073350180
556192173
-2131194899
-1263702330
-1241221134
927490167
-663648806
855525898
-54142775
-1761151153
-772786387
-600497310
-360667052
2075708212
1734397306
227337504
722031555
1383341439
-880112598
-858307427
568986914
-231591652
-1751155853
-1242879273
-1430454577
-1795130032
1991085991
-276715613
1794096619
59234396
-1984835396
2110900982
1843998616
357108247
577204887
104052110
-397984509
-112823072
-592274794
-1257536057
-60957422
1106388486
2139801536
-498411841
1057511879
980464008
915945975
758263279
-18350057
-397411291
-606822962
-2098533219
-2087116943
1902384256
248455249
-361487118
1806693269
-1637166242
355649857
629742175
525092775
-894304220
-500216042
-1630320171
616870731
400183467
1381021060
-1821506411
1944533824
1155274558
1412043550
-272033877
-1828707355
-1813354971
-857149766
1677947504
-927258464
-1108037885
-674595523
1501959472
-1061732789
219032289
459382241
1913385804
1678503616
1939694728
-1726211884
1437502106
-1912319233
-1823254569
1419843503
42458127
-551265690
2026145174
895145734
-1027467684
-1947601530
-1295116491
1225616901
-1386839364
661068499
954945717
1437077726
1523068128
-984025278
-204260625
-492843024
-736714787
1550153639
983007489
1293094445
1657691494
-590339824
516920338
672316635
1944676167
-1850776040
-1238545391
-696464771
796413053
-688455847
467323467
907250610
1434045170
-257016054
-1122398898
655984859
885092660
992399360
2026349554
1119461647
1192600567
-1235584795
1124611836
-1454889360
-526874483
203881792
432439150
-1245675518
-1232521418
-1982302302
323250310
1379897626
50179440
-307918485
1943062406
1250051361
-1816119597
-82105594
-223009559
372134459
774811270
1410627076
-1839951560
1953311133
939892132
-100934630
616466437
-1673453201
337610558
881387766
-765285047
591541886
444129153
1817706340
-2026670389
1653656652
-2121498485
-2076968522
-946025019
-216720147
-542970245
512414002
-67128780
-225327012
-1684083188
-1265675115
188124457
-226844691
1256830829
-679618271
-1771361092
-722752056
-490900241
-1508091651
-1622786720
965478182
-1014018278
-1728665982
-1769453917
41752791
1181604125
-1091437926
-1904878319
560800784
-319890871
-937624648
-338060742
1793735704
-1907480245
536690228
528982831
-1192880036
-1888238441
-1014252172
523010112
-952385661
204039337
-950541400
49570804
1261444251
-166271393
-85487021
2074754287
1730449881
1100824734
1254878417
-1268240435
-190274430
-556323976
406811682
945498183
2140471766
-1260729516
477269890
443621957
-1136998047
90061199
139271097
-977945598
358161804
1472058482
-611148348
546781129
1996319996
992732076
-206256760
1335384561
1286602020
-698527315
-694257322
1310214142
400013068
817549235
1698136534
-725533508
1936386524
-1115830530
2076325302
-222813658
1858426949
-1815987339
863773947
1376290703
-1303810541
1676179850
751206995
537626190
-506958241
-49607012
-320686240
-1981931629
-365275653
1187167143
286010371
-1400488896
892034032
1030616896
1622924196
-1876541661
-1060400108
1625665888
-418369246
232977693
320900030
--------------------------------------------------------------------------

Matthias Fischmann

unread,
Feb 6, 1995, 1:37:00 PM2/6/95
to

reply to msg [What's the best random number generator?] in newsgroup [/sci/math]
from [ch...@cs.usask.ca]
date: [03.02.95] time: [16:43]

> I found that the basic rand() in C is not entirely uniformly
> distributed, but it's not too bad.
>
> Over all these years, what is the best random number generator?
>

1) get any keystrokes from the user and calculate the time passing
between them in an arbitrary way (you can add them all and then take the
first two digits from the result, so you have a real random number between
zero and 99). realized in pgp by philip zimmermann and many others.

2) there are also radioactive random number generators (they base
on the completely arbitrary decay of atoms in radioactive substances), but
has anybody heard something about any suppliers or prices?

matze

ma...@phil15.uni-sb.de

--
matthias fischmann bismarckstr.6 66111 saarbruecken
phone +49 (681) 37392-4 fax +49 (681) 37392-5
email: ma...@phil.uni-sb.de f...@redlite.saar.de

Ken Smith

unread,
Feb 9, 1995, 9:53:06 AM2/9/95
to
In article <5fKU5...@redlite.saar.de>,

Matthias Fischmann <ma...@redlite.saar.de> wrote:
> 2) there are also radioactive random number generators (they base
>on the completely arbitrary decay of atoms in radioactive substances), but
>has anybody heard something about any suppliers or prices?

All you really need is a noise source and a counter. The noise generated
by the reverse break down of a diode junction amplified then connected to
a counter is just as random as the noise of a radioactive device. If you
really need random bits that a truely random you may want to have one of
you EE friends build you one of these.

--
Ken Smith <kens...@rahul.net>

Ǝ

unread,
Aug 4, 2023, 7:53:53 AM8/4/23
to
Your hand.

markus...@gmail.com

unread,
Aug 4, 2023, 3:50:29 PM8/4/23
to
fredag 3 februari 1995 kl. 17:43:06 UTC+1 skrev Henry Choy:
random.org
0 new messages