Let's get to it.
Math class: Mathematical class, including ABS () absolute value, sin () sine function, cos () cosine function, etc.
Random class: Gets the stochastic number of various data types
Example: Import java.util.random;/** * Demo get random number * @author Genius Federation-Yukun */public class Mathdemo {public static void main (string[] Arg s) {//Create the Random object random random = new random ();//Gets a double of type 0 to 1 for a double D = random.nextdouble (); System.out.println (d);//Gets a double of type 0 to 1 of the random number//its method is also implemented using random.nextdouble () to implement double Mr = Math.random (); System.out.println (MR);}}
This article from the "Genius Union Education Official Blog" blog, reproduced please contact the author!
I genius official free tutorial 24: Random Number of Java common classes Math class and Random class