[Python Wpg] Tested seed()

Sara Arenson sara_arenson at yahoo.ca
Thu Jun 28 10:18:00 EDT 2007


If you pass nothing, i.e. just write seed(), it automatically uses system time.

Sara

--- Richard Fillion <rick at centrix.ca> wrote:

> You shouldn't pass a static value to a random seed generator.  Pass  
> something that will change, such as the current time, or date, or ...  
> anything not-constant.
> 
> Richard Fillion
> e: rick at centrix.ca
> p: 204.291.5800
> 
> 
> 
> On Jun 28, 2007, at 12:05 AM, Mike Pfaiffer wrote:
> 
> > 	Here is some code.
> >
> > #!/usr/bin/python
> >
> > from random import seed, randint
> >
> > seed(2)
> > for c in range(10):
> >      print c,randint(1,10)
> >
> >
> > 	Ran it twice under idle and the same results came out three times.
> > Looks like it is best to run it without a value in seed().
> >
> > 	Here is what I got...
> >
> > IDLE 1.2.1
> >>>> ================================ RESTART
> > ================================
> >>>>
> > 0 10
> > 1 10
> > 2 1
> > 3 1
> > 4 9
> > 5 8
> > 6 7
> > 7 4
> > 8 7
> > 9 7
> >>>>
> >
> > 				Later
> > 				Mike
> >
> > _______________________________________________
> > Winnipeg mailing list
> > Winnipeg at python.org
> > http://mail.python.org/mailman/listinfo/winnipeg
> >
> 
> _______________________________________________
> Winnipeg mailing list
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
> 



      Get news delivered with the All new Yahoo! Mail.  Enjoy RSS feeds right on your Mail page. Start today at http://mrd.mail.yahoo.com/try_beta?.intl=ca



More information about the Winnipeg mailing list