Write code to declare and instantiate an object of the Random class (call the object reference variable rand). Then write a list of expressions using the nextInt method that generate random numbers in the following specified ranges, including the endpoints. Use the version of the nextInt method that accepts a single integer parameter.
```
Random rand = new Random();
```
a. 0 to 10
b. 0 to 500
c. 1 to 10
d. 1 to 500
e. 25 to 50
f. –10 to 15
```
a. rand.nextInt(11)
b. rand.nextInt(501)
c. rand.nextInt(10) + 1
d. rand.nextInt(500) + 1
e. rand.nextInt(26) + 25
f. rand.nextInt(26) – 10
```
Computer Science & Information Technology
You might also like to view...
An object created from a class is called an instance.?
Answer the following statement true (T) or false (F)
Computer Science & Information Technology
It is not possible to extract analytical data from operational databases.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology