开发者

Random number with uniform distribution over a long period

开发者 https://www.devze.com 2023-02-17 12:19 出处:网络
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 s

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号