/******************************************************************************
* Example of using the Random class
******************************************************************************/
import java.util.Random;             

public class Random1 
{
    public static void main(String[] args) 
    {        
        System.out.println();

        Random r1 = new Random();                           //instantiate without a seed
        
        for (int i=0; i<10; i++)
            System.out.print(r1.nextInt(1000) + ", ");      //from 0 to 999
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r1.nextInt(1000)+500 + ", ");  //from 500 to 1499
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r1.nextInt(200)-100 + ", ");   //from -100 to 99
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r1.nextInt() + ", ");          //from -2B to +2B
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r1.nextFloat() + " ");         //from 0.0 to <1.0 
        System.out.println("\n");


        System.out.println("Repeatable Random Numbers:\n");

        Random r2 = new Random(1234567890);                 //instantiate with a seed 
                                                            //repeatable sequence       
        for (int i=0; i<10; i++)
            System.out.print(r2.nextInt(1000) + " ");       //repeatable
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r2.nextInt() + " ");           //repeatable
        System.out.println("\n");

        for (int i=0; i<10; i++)
            System.out.print(r2.nextFloat() + " ");         //repeatable        
        System.out.println("\n");
     }
}