In Java, there is a method random() in the Math class, which returns a double value between 0.0 and 1.0. In the class Random there is a method nextInt(int n) , which returns a random value in the range of 0 (inclusive) and n (exclusive). I'm sure you must have faced below questions in past: How to generate random numbers …
Read Article about How to Generate Random Number in Java with Some Variations? →