Question: Run the below code and Fix the errors if occur : public static int[] generateRanNums(int num) { int[] anArray = new

Run the below code and Fix the errors if occur :

public static int[] generateRanNums(int num)
   {
       int[] anArray = new int [num];
        //1. Using Random class, generate in a for-loop 20K numbers in the range of 1 to 5000
       Random myRan = new Random();
       int aNum;
       
       if (num == 10)
       {
           //make a 10-element array
            //for-loop for generating 10 numbers between 1 & 100'
       
               
           }
           
       }
       else
       {
           //make a 20,000 - element array
           
           //for-loop for generating 20,000 numbers between 1 & 5000
           
           
       }
           
     
           return anArray;
       
   }  

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the corrected code with the errors fixed java import javautilRandom public class RandomNumbe... View full answer

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 Operating System Questions!