random number generator random() questionable!!!?

Stephen Quan quan at sol.surv.utas.oz
Mon Sep 17 17:34:11 AEST 1990


Don't know if anyone interested, but I use :

int random()
{
  static int seed = 0;
  seed = (seed * 13077 + 1729) % 32768;
  return seed;
}

Which is short, simple, will give a cycle of 32768 however, but seemlingly
a fairly scattered region.  I wrote it, so I like it!!!  Only my 2c worth.

Stephen Quan,
University Of Tasmania,
School of Surveying,
Aussie.



More information about the Comp.lang.c mailing list