• Source
    1. /*
    2.  
    3.  
    4. Date : 14 November 2013
    5. Author : Shivam Tiwari
    6. Organization : http://mycodedock.blogspot.in/
    7. Description : Random Integers in Java
    8.  
    9.  
    10. */
    11.  
    12.  
    13. //import the Random library (class)
    14. import java.util.Random;
    15.  
    16. //main class
    17. public class Main{
    18.  
    19. //main function
    20. public static void main(String[] args){
    21.  
    22. //create an object of the Random class named randomObj
    23. Random randomObj = new Random();
    24.  
    25. //declaring variables that will be used later
    26. int x;
    27.  
    28. //run the loop 100 times from 0 to 99
    29. for(int i = 0; i < 99 ; i++){
    30.  
    31. //generate a random integer and store in x
    32. x = randomObj.nextInt();
    33.  
    34. //print the value in x
    35. System.out.println(x);
    36. }
    37. }
    38. }