View Single Post
  #2 (permalink)  
Old March 11th, 2019, 02:31 AM
Eureka117 Eureka117 is offline
Registered User
Points: 23, Level: 1
Points: 23, Level: 1 Points: 23, Level: 1 Points: 23, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2017
Posts: 3
Thanks: 0
Thanked 2 Times in 1 Post
Default I forgot to add return result;

Well I found out what I did wrong. It turns out that I forgot to return the result. So not wonder the program would not compile.

Here's the code I needed to add:

Code:
return result;
So the whole function needs to look like this:
Code:
private static int[] generateLotsOfNumbers(int count)
        {
            Random generator = new Random(0);
            int[] result = new int[count];
            
            for (int i = 0; i < count; i++)
            {
                result[i] = generator.Next();
            }
            
             return result;

        }
Reply With Quote