Random Number, random number generator
Math. random () generates a random number of the double type in the range of [0, 1. Thread security: multi-threaded environments can be called.
(Int) (Math. random () * n) generates a random integer between [0, n. For example, (int) (Math. random () * 100) is used to generate a random integer between [0,100.
Unless otherwise specified, use (int) (Math. random () * n.
Random. nextInt (n) generates a pseudo-random integer between [0, n), where parameter n must be a positive integer. If it is a negative integer, it will report: java. lang. IllegalArgumentException
Pseudo-Random Number: the Random number sequence generated by the Random object with the same number of seeds is the same.
System. out. println ("a:" + random1.nextInt (2000) + "=" + "B:" + random2.nextInt (2000); a and B are always the same.