On Sat, Dec 06, 2003 at 04:38:02PM -0800 John W. Krahn wrote:

> Pd Schloss wrote:

> > I'm reviewing a perl script that someone wrote to do a statistical
> > analysis.  I know it's bad form, but I was wondering if anyone knows
> > what the default seed is for the random number generator in Perl.  They
> > haven't seeded it with "srand" - what does this do?  It still seems to
> > pick random numbers, any ideas?
> 
> Download the source code for Perl if you don't already have it and have
> a look at the pp.c file.

The actual seed is calculated in Perl_seed() in util.c. The calculation
of the seed itself is highly dependent on the platform used. It involves
various things, such as gettimeofday(2), the PID, a value read from a
random device such as /dev/urandom, the position of PL_stack_sp in
memory etc. For most cases it should be quite ok.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to