The Random class provides a template for the creation of random number generators. The Math.random() method provides a static function for the generation of random double values.
Two constructors are provided for creating Random objects. The default constructor initializes the seed of the random number generator using the current system time. The other constructor allows the seed to be set to an initial long value.
class MathRandom { public static void main(String args[]) { int i; for(i=1;i<=10;i++) { System.out.println(Math.random() ); } } }