So I'm programming a simple Linear Congruential Generator (basically a random number generator)
So that part works. Now I want to transform the numbers I get to ~ U(0,1) (uniform distribution between 0 and 1. The way to do this is to take the values you get from the generator and divide by m )
So after running both functions (with m = 1572), I check the arrays. The array storing the randomly generated numbers is fine.... but the array storing the transformed numbers are all 0.0. Am I doing something wrong??
1
22
211
340
1501
946
667
1300
Those are the first few numbers generated.....
so the numbers in the U array should be
.000636
.01399
.1342
.216
.9548
.6017
etc
Anyone see the problem??
So that part works. Now I want to transform the numbers I get to ~ U(0,1) (uniform distribution between 0 and 1. The way to do this is to take the values you get from the generator and divide by m )
So after running both functions (with m = 1572), I check the arrays. The array storing the randomly generated numbers is fine.... but the array storing the transformed numbers are all 0.0. Am I doing something wrong??
1
22
211
340
1501
946
667
1300
Those are the first few numbers generated.....
so the numbers in the U array should be
.000636
.01399
.1342
.216
.9548
.6017
etc
Anyone see the problem??
