Given integer inputs seed, how_many, and max_num, generate a list of how_many unique random integers from 0 to max_num (inclusive). Complete function unique_random_ints(how_many, max_num): Generate a list of how_many random integers from 0 to max_num (inclusive). When a random number exists in the list, a new random number must be generated; use a global variable, retries, to count the number of times an existing number is generated. Return the list. Complete __main__: Initialize the random module with the seed value. Call unique_random_ints() to get a list of random integers. Output the list of random integers and the value of retries, according to the output format shown in the example below. Ex: If the input is: 2 5 7 the output is 0 1 5 2 4 retries=1
Given integer inputs seed, how_many, and max_num, generate a list of how_many unique random integers from 0 to max_num (inclusive). Complete function unique_random_ints(how_many, max_num): Generate a list of how_many random integers from 0 to max_num (inclusive). When a random number exists in the list, a new random number must be generated; use a global variable, retries, to count the number of times an existing number is generated. Return the list. Complete __main__: Initialize the random module with the seed value. Call unique_random_ints() to get a list of random integers. Output the list of random integers and the value of retries, according to the output format shown in the example below. Ex: If the input is: 2 5 7 the output is 0 1 5 2 4 retries=1
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 16SA
Related questions
Question
Given integer inputs seed, how_many, and max_num, generate a list of how_many unique random integers from 0 to max_num (inclusive).
- Complete function unique_random_ints(how_many, max_num):
- Generate a list of how_many random integers from 0 to max_num (inclusive).
- When a random number exists in the list, a new random number must be generated; use a global variable, retries, to count the number of times an existing number is generated.
- Return the list.
- Complete __main__:
- Initialize the random module with the seed value.
- Call unique_random_ints() to get a list of random integers.
- Output the list of random integers and the value of retries, according to the output format shown in the example below.
Ex: If the input is:
2 5 7
the output is
0 1 5 2 4 retries=1
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L