/* RJBottings DIY random number generator
Initially written in Pascal on a PDP11/44,
Then into PRIME C, and so to 11/24 BSD UNIX C,ANSI C....
ad nauseam.
*/
static int seed=123; /*seed for function random. This is hiden from code in
in other files but exists from the beginning to the
end of the run*/
/*Can be intialized to any integer value between 1 and 32738*/
float random(void)/*returns a pseudo-random number in the range 0 to 1*/
{
seed= (125L * (long int)seed)%32749L;
return( seed / 32749.0 );
}
#include
void randomize(void)/*Change value of seed to a different value*/
{
seed=time(NULL) %32738 +1;
}