Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(20 pt) Create a file called generator.py. In this file, create a class called LCG whose instance can generate random numbers by Linear Conguen- tial
(20 pt) Create a file called generator.py. In this file, create a class called LCG whose instance can generate random numbers by Linear Conguen- tial Generator algorithm. It should have these data attributes: self.seed, self.multiplier, self.increment, self.moduus which are assigned in initial- izer (init-0). The parameters should be passed by argument from out side of the class. This class's instance should also at least have function attributes allow me: 1) get the seed; 2) set the seed; 3) initialize the gener ator (start from the seed); 4) give me the next random number 5) give me a sequence (list) of random number, the length should be passed by argu- ment. (20 pt) Create a file called generator.py. In this file, create a class called LCG whose instance can generate random numbers by Linear Conguen- tial Generator algorithm. It should have these data attributes: self.seed, self.multiplier, self.increment, self.moduus which are assigned in initial- izer (init-0). The parameters should be passed by argument from out side of the class. This class's instance should also at least have function attributes allow me: 1) get the seed; 2) set the seed; 3) initialize the gener ator (start from the seed); 4) give me the next random number 5) give me a sequence (list) of random number, the length should be passed by argu- ment
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