The use of random numbers is sometimes encountered in software development (some codes are random numbers generated by random). Previously only know how to use, have never thought about the principle of random. A few days ago remember to go online to check this problem, today just have time, from the Internet to access some information.
Java contains two types of random, one is java.util.Random, the use of pseudo-random (random), the same number of random objects, the same number of times generated by the number is exactly the same. This random class includes two constructors, public random (), and public random (long Seed). The stochastic methods of this class are more, including Nextboolean (), Nextint, nextdouble () and so on.
The other is that the random,math.random under math generates a [0,1.0 interval of decimals] (which is actually called Java.util.random China's Nextdouble () method)
Random () function parsing in Java