Tuesday, September 8, 2020

JAVA Program | Generate Random Numbers | Diploma Computer Engineering | MCA | BCA | Information Technology

 

//JAVA Program to generate Random Numbers

package Diploma;

import java.util.*;

/**

 *

 * @author Ashok Roshan

 */

public class Randomnumbers 

{


  public static void main(String[] args) {

    int i;

    Random t = new Random();


    // random integers in [0, 100]


    for (i = 1; i <= 20; i++) {

      System.out.println(t.nextInt(100));

    }

  }

/*

Output

run:

27

48

74

71

24

32

79

86

38

29

4

71

6

80

35

94

17

45

7

39

BUILD SUCCESSFUL (total time: 0 seconds)

*/

No comments:

Post a Comment

Computer Objective Questions || Practice Set || Shishu Varg || Class 4 & 5

1) What is the first mechanical calculating device of the world? Answer:- Abacus Q2) Who is Know as the world's First Programmer...