Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using System; namespace RandomArray { public class RandomArrayNoDuplicates { static Random rng = new Random(); /// /// Creates an array with each element a unique

image text in transcribed

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) { } } }
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()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago