#include #include #include #include #include #include #include #include #include //int is changed to uint and the overflow error goes away //this is because now there is no sign bit //remember 2^31 means 1 in the msb and all other bits zero //in a 32 bit word, so all the 32 bits are required to hold //the number double GetUniform(uint seed=12345) { static uint Xn = seed; const uint m = pow(2,31); Xn = (65539*Xn)%m; return (double)Xn/(double)m; } int main(){ for (int ii = 0; ii < 10; ii++){ std::cout<