On Wed, Mar 14, Ivan Sagalaev wrote:

> 
> Michael Radziej wrote:
> > Beginning with python2.4, the seed also uses os.urandom() when available, so
> > it starts to get safer.
> 
> Uhm... But it still happens only once on first module import. So it's 
> not safer at all.

If you have multiple processes which initialize their random
module at exactly the same system time (how granular is it?, you'll get the
same seed and therefore the same sequence of pseudorandom numbers in
python2.3

In python2.4, the seeds will be different, thus you'll get different
numbers.

Just to put it clear: Something that prevents handing out a session
id that is already in use should be installed additionally.

> 
> > I'm not sure whether it's a good idea to add periodic reseeding. 
> 
> Why not? I'm not an expert also but I just don't see any disadvantages 
> beside speed which is still incomparable to INSERTing a session into 
> database.

The sequence should obey certain other statistical rules. I am not sure
if reseeding could break it. I simply know enough about it to be cautions,
and I'm not deep enough into it to recommend reseeding or not reseeding ;-)


Michael


-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to