jeudi 30 avril 2015

java.util.Random NextDouble() is biased towards higher uniform number

I am using NextDouble() to generate uniform random number. I generated random number with 500 different seeds and found that the generated uniform random number is biased towards higher uniform number (mean was 0.93). Which is very absurd. I then divided the seed by 10000 and the random number generated was perfect (mean was 0.51). I found that the seed should not be more than 48 bits and so made sure that the seed I provide (seed for NextDouble() is generated randomly using nextLong() with seed = 12345) is less 48 bits. Then I re-generated the random number 500 times and found the same problem. Does anyone had similar issues with NextDouble()?




Aucun commentaire:

Enregistrer un commentaire