Question: The Java code below generates number from 0 to 35. I want the code to generate number from 1 to 35. How do I solve
The Java code below generates number from 0 to 35. I want the code to generate number from 1 to 35. How do I solve that? Thanks! import java.util.Random; public class Main { public static void main(String[] args) { Random rnd = new Random(); double result = Math.round(rnd.nextDouble() * 35); System.out.println(result); } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
