Question: (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

(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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!