/**************************************************************** * uran.c - This function generates pseudo-random numbers ****************************************************************/ static long xn = (long)12357; // seed x(0) = 12357 float uran() { float ran; // random number r(n) xn = (long)2045*xn + 1L; // x(n+1)=2045*x(n)+1 xn -= (xn/1048576L)*1048576L; // x(n+1) mod M ran = (float)(xn + 1L)/(float)1048577; // normalization return(ran); // return r(n) to main function }