java.lang.Math
A bunch of mathematical methods
* Public static int ABS (int A) * public static Double ceil (Double A) * public static Double Floor (Double A) * public static int max (int A, int B) min Self * public static double pow (double a , double b) // a, b th * public static double random () self * public static int round (float a ) rounding of double parameter * public static double sqrt (double a ) the square root of * /
Math.random (): returns greater than or equal 0.0
to less than 1.0
a pseudo-random double
value.
Random category
Random r = new Random();
int x = r.nextInt (); // generates a random number
int y = r.nextInt (100); // generates a random 0-99 wherein a
Math.random () more convenient to use
* A: Random Class The * type for generating a random number if the Random creates two instances with the same seed, * for each instance of the same sequence of method calls, which will generate and return the same sequence of numbers. * B: Constructor * public Random () * public Random (Long the SEED) // use a seed to generate random numbers * C: member method * public int nextInt () * public int nextInt (the n-int) (master key) * /