Random number with uniform distribution over a long period
I would like to generate (quality) random numbers in my Java EE application over a long period开发者_运维问答 of time (dozens of numbers per day). It should keep the uniform distribution even if the server is restarted etc. Do you have any recommendation as to how to achieve this?
All of the methods in java.util.Random
return a uniform distribution of random numbers except for nextGaussian().
As far as not generating predictable sequences of random numbers, Why not just set the seed to the time of day in milliseconds XORed with the current process id?
Uncommons Maths is a library that offers some RNGs that are more robust than those in the jdk
精彩评论