Computer Science, asked by jsprashantchouhan, 8 months ago

Write one single line statement to generate random whole number in the range from 1 to 6.​

Answers

Answered by Anonymous
6

Answer:

Java Random number between 1 and 10

  • For example, in a dice game possible values can be between 1 to 6 only. Below is the code showing how to generate a random number between 1 and 10 inclusive. Random random = new Random(); int rand = 0; while (true){ rand = random. nextInt(11); if(rand !=

Similar questions