If I use the Python function random.seed(my_seed) in one class in my module, will this seed remain for all the other classes instantiated in this module?
If I use the Python function random.seed(my_seed) in one class in my module, will
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the seed is set for the (hidden) global
Random()instance in the module. From the documentation:Use separate
Random()instances if you need to keep the seeds separate; you can pass in a new seed when you instantiate it:The class supports the same interface as the module.