

		               [43m  RANDOM NUMBER GENERATING  [0m

			               [3m by Peter Thompson


[32m   (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))



[33m   * WARNING : YOU USE THIS CODE AT YOUR OWN RISK!!!

   * There were no parts of this code intentionally designed to cause any
  kind of damage to any system when it left me.

   * If you use this code in any program for which you ask the user to pay,
  send me a copy of your program.

[33mWhat?
[33m~~~~~
  This package consists of:
	* Random.doc, which you are reading;
	* random.o, a C link "library" for generating random numbers;
	* random.asm, A68k assembler source for same;
	* random.h, a C include file for the random number generator;
	* chisqr.c, a C function to test the "randomness" of a random
	number generator.
	* randtest.c, a C program that applies the chi-squared test to
	the random number generator in random¹.

   ¹ I wrote it to help me debug the thing, so you might as well have it...

[33mWhy?
[33m~~~~
  Random is a module for generating random numbers. The standard random
  number generators inplemented by most languages have a "period" - the
  number of numbers before the sequence begins to repeat - of 2^16-1 or
  65535. However, some applications (simulations, etc.) need longer periods
  than this. Random provides sequences of length 2^55-1, or more than
  36028797018700000. To put this (rather large) number in perspective, at
  100,000 random numbers/second (about peak performance of the generator on a
  standard A500), it would take over ten thousand YEARS to repeat itself.


[33mHow?
[33m~~~~
  Using it from C is simplicity itself:

  #include <stdio.h>
  #include "random.h"

  main(int argc, char *argv[])
  {
    RandState *randbase;
    long i;

    randbase = (RandState *) malloc(sizeof(RandState));

    rand32init(randbase, atoi(argv[1]));
  /* OR set randbase->rs_Index to 0 and initialise the rs_State array with
your own set of 32-bit numbers, if you want more than 2^32 possible
sequences. */
    for (i = atoi(argv[2]); (i>=0); i--)
      printf("%f\n", rnda32(randbase)/(float) MAXRNDNUM);
  }

and be sure to link with -lrandom.o as one of the command line parameters.


[33mWho?
[33m~~~~
	[3mPeter Thompson
	33 Pleasant Street
	Pascoe Vale 3044
	Australia


[32m   (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))



