Question
Write a C# program to generate unique random integers. Theprogram will ask the user three things: (a) number of random integers the user wants to
Write a C# program to generate unique random integers. Theprogram will ask the user three things:
(a) number of random integers the user wants to generate
(b) the lower limit of the random integers (i.e. how small therandom integers can be)
(c) the upper limit of the random integers (i.e. how large therandom integers can be)
Display the random numbers generated. These numbers areall unique (i.e. No two numbers are the same). The followingis an example:
If the numbers of random integers the user want to generate isgreater than the number of possible unique integers between thespecified limits, display an error message and ask the user tore-enter his request:
In the example above, the user asks for 10 unique randomintegers in the range of 0 and 5. However, there are only 6unique integers in this range: 0, 1, 2, 3, 4 and 5. Therefore, it is impossible for the program to satisfy the user?srequest.
The user re-enter his request. The program generates alist of random integers the user asked for:
C: C:\Windows\system32\cmd.exe How many random number do you want to generate? 10 How small can these random integers be? 5 How large can these random integers be? 17 5 12 14 9 11 8 7 10 16 6 Press any key to continue 111 x
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
Answer Executable C Code using System using SystemCollectionsGeneric using SystemLinq using SystemTe...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