True random generation in Java

后端 未结 13 2260
一生所求
一生所求 2020-12-01 01:18

I was reading the Math.random() javadoc and saw that random is only psuedorandom.

Is there a library (specifically java) that generates random numbers according to

相关标签:
13条回答
  • 2020-12-01 01:58

    Be sure that you really want "true" random numbers. Physical sources of randomness have to be measured, and the measurement process introduces some bias. For some applications, "pseudo" random numbers are actually preferable to "true" random numbers. They can have better statistical properties, and you can generate them faster. On the other hand, you can shoot yourself in the foot with pseudorandom number generators if you're not careful.

    0 讨论(0)
  • 2020-12-01 01:58

    There is no true random number generator since they all rely one way or another on deterministic procedures to compute a random number, so, no matter how generated numbers appear to follow a true random distribution, they might be a part of a hidden -and very complex- pattern, hence they are Pseudo-Random. However, you can implement your own random number generator, there are a couple of nice, computational-cheap methods you can read in Numerical Recipes in C, Second Edition - Section 7. HTH

    0 讨论(0)
  • 2020-12-01 02:01

    Check out http://random.org/

    RANDOM.ORG is a true random number service that generates randomness via atmospheric noise.

    The Java library for interfacing with it can be found here: http://sourceforge.net/projects/trng-random-org/

    0 讨论(0)
  • 2020-12-01 02:03

    See also this SO question: Alternative Entropy Sources

    I found HotBits several years ago - the numbers are generated from radioactive decay, genuinely random numbers.

    There is a java library for access at randomx

    There are limits on how many numbers you can download a day, but it has always amused me to use these as really, really random seeds for RNG.

    0 讨论(0)
  • 2020-12-01 02:04

    In college I had task to implement random generator. I created random number generator like this: created desktop window and asked a user to click on random places on the window, after each click i took coordinates of clicked point. That was pretty random i think.

    0 讨论(0)
  • 2020-12-01 02:05

    The Java Cryptographic Architecture requires cryptographically-strong random numbers. It contains the SecureRandom class mentioned by @saua.

    0 讨论(0)
提交回复
热议问题