Random1.java Source code

Java tutorial

Introduction

Here is the source code for Random1.java

Source

/** Demonstrate the easy way of getting random numbers,
 * using java.lang.Math.Random().
 */
public class Random1 {
    public static void main(String[] argv) {
        //+
        // java.lang.Math.random() is static, don't need to construct Math
        System.out.println("A random from java.lang.Math is " + Math.random());
        //-
    }
}