Answered step by step
Verified Expert Solution
Question
1 Approved Answer
whats the answer in python ? Write a function randomNumbers with two parameters upTo and num. The function will generate num integers each between 1
whats the answer in python ?
Write a function randomNumbers with two parameters upTo and num. The function will generate num integers each between 1 and upTo. These integers should be added to a set (not a listi). At the end the function returns the number of unique numbers generated (which corresponds to the size of the set). If the function returns the same as num, it means that all generated numbers were different, but if the number returned is less than num than it means that a random number was selected more than once. If you try the function with upIo =365, then this is the same as choosing birthdates randomly. What value should you give to num to have a high chance of getting the same birthday twice (the function returns less than num)? Try for example, 10, 25, 50, 100 . Sample run: While drawing 10 randoa numbers between 1 and 365 , we obtained 18 different numbers, and collusions. While drawing 25 random numbers between 1 and 365, we obtained 24 different numbers, and 1 collustons. While drawing 56 random numbers between 1 and 365 , we obtained 45 different numbers, and 5 collusions. While drawing 16e random numbers between 1 and 365, we obtained 89 different- numbers, and 11 collusions. While drawing 180 randon numbers between 1 and 365 , we obtained 146 different numbers, and 34 collusions 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