linda.s wrote:
> I read something about random.seed() but still confused. i can
> understand random.random() but it is very hard for me to understand
> random.seed(0... can anyone explain an example?
>   
I suggest you read 
http://en.wikipedia.org/wiki/Pseudorandom_number_generator to get the 
gist of pseudorandom number generation. Section 4 Mersenne twister 
<http://en.wikipedia.org/wiki/Pseudorandom_number_generator#Mersenne_twister> 
is the algorithm used by Python random.

random.seed() sets the starting number for the generator. Setting the 
seed to a known value can be important if you want the same sequence of 
pseudorandom numbers to be generated each time you test/run your 
program. Note that in Python "the current system time is ... used to 
initialize the generator when the [random] module is first imported." 
This pretty well ensures that the sequence of numbers generated will be 
different each time.

HTH.

-- 
Bob Gailer
510-978-4454

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to