Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using System; namespace RandomArray { public class RandomArrayNoDuplicates { static Random rng = new Random(); /// /// Creates an array with each element a unique
using System; namespace RandomArray { public class RandomArrayNoDuplicates { static Random rng = new Random(); ///Using C#, write a method called Initial izeArraywithNoDu plicates ( ), using the provided method header below. which will return a one dimensional array 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 integer which is greater than or equal to minValue and less 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 Include a simple DisplayArray() method similar to that in the linear search to output the resultant array, called from Main()/// 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) { } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started