Program

 /* a very simple random number generator */

#include <stdio.h>

#define max 1000		/* number of numbers generated */
#define seed 11                 /* seed for number generator */

FILE *output;			/* internal file name */

main ()
{
int i, old, newx, newy;
 
old=seed;				/* the seed */

output = fopen("random.dat", "w");   	/* external file name */   

    

/* generating random numbers */

for (i=0; i<=max; i=i++)
{
 
   newx= (57*old+1) % 256;		/* one for x- and */
   newy= (57*newx+1) % 256;		/* one for y-direction */
   
   fprintf (output, "%i\t%i\n", newx, newy);
   
   old=newy;
}

fclose (output);
}

A source code which you can save and run on your computer.
Back to main document.