Question: In Java, is there a way to pass the results of what I get in this method (5 unique random numbers and a random powerball)

In Java, is there a way to pass the results of what I get in this method (5 unique random numbers and a random powerball) to a separate array method which stores the result and checks for duplicates?

public static void lottopicks(int[]numpassed) { Scanner read = new Scanner(System.in); Random rand = new Random(); int num; int min = 1; int max; int num1; int min1=1; int max1=40; { while (true) { System.out.println("What is the upper range of values you want to use for Random numbers): " + "valid value is between 23 and 100 (e.g, enter 54 to generate numbers between 1 and 54)"); max = read.nextInt(); if(max >= 23 && max <= 100) { break; } System.out.println("Please enter a valid range. "); } System.out.println("The Easy Pick Randomly Generated Numbers Are:"); for (int i = 0; i <= 4; i++) { num = rand.nextInt((max + 1) - min) + min; System.out.print(num + " "); numpassed[i]=num; } for (int j=0; j<=0; j++) { num1 = rand.nextInt((max1 + 1) - min1) + min1; System.out.print("Powerball is " + num1); } } } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!