|P is for Practical|
Getting srand's seedby fangly (Initiate)
|on Oct 09, 2008 at 23:46 UTC||Need Help??|
fangly has asked for the
wisdom of the Perl Monks concerning the following question:
It's got to be easy... however I spent hours searching how to do it unsucessfully.
I just want some random numbers such as the ones produced by rand(). I don't even want to bother creating my own seeds for the random number generator, but I need to retrieve the seed to be able to regenerate the exact same series of random numbers in case I need it. According to the documentation srand() is automatically called by Perl.
Is it possible to retrieve what seed value srand() has used for the random number generator?? I think it's possible in Java, Matlab, ... In a desperate attempt, I tried $seed = srand(); but that returns 1 all the time.