perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Prime <adam.pr...@utoronto.ca>
Subject Re: srand
Date Sat, 04 Apr 2009 23:52:08 GMT
Stanisław T. Findeisen wrote:
> Hello
> 
> I have a question regarding srand() usage with mod_perl. The 
> documentation says:
> 
> =======================================================================
> Do not call srand() (i.e. without an argument) more than once in a 
> script. The internal state of the random number generator should contain 
> more entropy than can be provided by any seed, so calling srand() again 
> actually loses randomness.
> 
> http://perldoc.perl.org/functions/srand.html
> =======================================================================
> 
> How does this relate to mod_perl? Is it safe to simply call srand() once 
> per CGI script?
> 

Personally, i call srand in my startup.pl, and not in individual cgi 
scripts.  I have no idea if that's actually a good practice or not 
though.  It might for example be a better idea to call it in a ChildInit 
  handler.

Adam

Mime
View raw message