Write a method called randomInRange that accepts two integer parameters representing a range. The method should return a random integer in the specified range (inclusive). Assume that the first parameter is greater than the second.

What will be an ideal response?


```
public int randomInRange (int first, int second)
{
Random generator = new Random();
int range = second – first + 1;
return generator.nextInt(range) + first;
}

```

Computer Science & Information Technology

You might also like to view...

The company involved in an attack by Oleg Zezev from Kazahkstan, in which Zezev accessed computer data and copied personal information for purposes of blackmail was ______

a. General Motors b. Interactive Television Technologies, Inc. c. Bloomberg, Inc. d. None of the above

Computer Science & Information Technology

A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user checked the paper in the supply tray, and it is smooth and unwrinkled.   Which of the following is the most likely reason for the wrinkled paper? (Select TWO.)

A. The paper does not meet the requirements for the printer. B. The user is selecting the wrong driver for the printer. C. The paper is creased before it is installed in the printer. D. The pages being printed are using too much toner. E. The paper is damp when run through the printer. F. The printer does not have enough free memory.

Computer Science & Information Technology

What automatically created subdomain holds all the SRV records for Microsoft-hosted services, such as the global catalog, LDAP, and Kerberos?

A. _mssrv B. _services C. _srv D. _msdcs

Computer Science & Information Technology

Select below the band that is not one of the four frequency bands used in the 5 GHz range for wireless LANs:?

A. ?5.1 GHz B. ?5.3 GHz C. ?5.4 GHz D. ?5.9 GHz

Computer Science & Information Technology