Question: sample code: using System; namespace RandomArray { public class RandomArrayNoDuplicates { static Random rng = new Random(); /// /// Creates an array with each element

 sample code: using System; namespace RandomArray { public class RandomArrayNoDuplicates {

sample code:

using System; namespace RandomArray { public class RandomArrayNoDuplicates { static Random rng = new Random(); ///  /// Creates an array with each element a unique integer /// between 1 and 45 inclusively. ///  ///  length of the returned array  /// an array of length "size" and each element is /// a unique integer between 1 and 45 inclusive  public static int[] InitializeArrayWithNoDuplicates(int size) { } } }

For this exercise, you are asked to write a method called InitializeArraywithNoDuplicates (), using the provided method header below, which will return a one dimensional y in which every element is a randomly generated integer between 1 and 45 inclusive with no integer value occurring more than once in the array The length of the array is passed as a parameter to the method and you can assume that the parameter value will be less than 45 and greater than zero Use the Random class method int Next int minvalue, int maxValue which returns a random ?????? w ch s great 1 an orequa imnalean arra ess than maxValue. To enable you to test your code, you should create a Main() method that calls the InitializeArraywithNoDuplicates() method several times with different parameters each time to show that the method is correct; similar to the Main() method of the linear search exercise in Week 4. lude a simple DisplayArray() method similar to that in the linear search exercise to output the resultant array, called from Main() Exactly what you do to test the method and display the array is not important or your MS m arks as only your InitialzeArrayN?thNoDuplicates This means it must be public. If you still have difficulties, here are some tips when writing programs for AMS: method will be run. Do not write your program directly into the text box. You should copy and paste the sample code into Visual Studio, write your program there, run it and test it to make sure it works, then paste it into AMS. You only get a limited number of attempts at each AMS exercise, so make sure they count If your code uses Console.ReadKey(); it should be replaced with Console.ReadLine(). ReadKey () will work in Visual Studio but not in AMS. Make sure your code displays exactly what the problem asks you for. If you can, copy and paste the text you need to display into your function to avoid possible transcription errors. If there are any mistakes at all your code will not pass

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!