2 * Because the standard library random number
3 * functions are not availble at the kernel level
4 * I wrote this simple random number generator.
6 * It uses the multiplicative congruential method.
7 * See pg 263 of Banks and Carson "Discrete-Event
14 static unsigned x0=123457; /* seed */
15 static unsigned a=16807; /* constant multiplier */
16 static unsigned c=0; /* increment */
17 static unsigned m=2147483647; /* modulus */
20 * Set the seed to the argument.
23 void srand(unsigned i)
30 * Use Linear Congruential Method to Generate
31 * sequence. Return either int or float...
38 tmpseed = (a*x0+c) % m;
49 tmpseed = (a*x0+c) % m;