On Thu, 2 Feb 2006, kevin parks wrote:
> Danny (hope you are good!) & co, > > I see that biz about random.seed()... but in the absence of setting that > ... does it just grab a value from the system clock? Yes. Here's what the documentation says officially: """current system time is also used to initialize the generator when the module is first imported""" > Is there a way to just let it generate it's usual, known seed... but > then observe what that is in case you get an especially good run of > data? We can call seed() explicitely using system time then when we start using the random module, and if the results are interesting, we report that initial seed value too. That way, by knowing the initial conditions, we can reproduce the results. ###### >>> import time >>> import random >>> >>> t = time.time() >>> >>> random.seed(t) >>> random.random() 0.39026231885512619 >>> random.random() 0.72296902513427053 >>> random.random() 0.48408173490166762 >>> >>> t 1138866167.719857 >>> >>> random.seed(t) >>> random.random() 0.39026231885512619 >>> random.random() 0.72296902513427053 >>> random.random() 0.48408173490166762 ###### _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor