35bits random generator

Luong La luong at grace.cs.washington.edu
Thu Feb 9 14:44:34 AEST 1989


Many msgs were concerning with rand(), so here one of the rand35() I used.
note: MSC5.1 had fmod function -> floatingpoint modulo

#include <math.h>
static double z35=0.00001;
double rand35()
{ z35 = fmod(3125.0*z35,34359738340.0); return z35;}
/* normalize -> [0,1] */
double nrand35()
{return (rand35()/3435973839.0);}

credits: I copied this generator from some where and I believed it
calls <PRIME MODULUS MULTIPLICATIVE LINEAR CONGRUENT GENERATOR>


===RLab===Epsilon task takes infinite time=== luong at grace.cs.washington.edu



More information about the Comp.lang.c mailing list