On March 2, 2010, I asked on Stackoverflow, âHow can I store the state of the pseudo-random generator in Perl?â
At the time, the answer was âyou can't do that using the builtin pseudo random number generator.â Now, as I have mentioned before, using the builtin pseudo random number generator is fraught with traps regardless of language.
However, I was very happy to find out, via David Golden's Lightning
(because I was too lazy to read the perldeltas first, I admit), that, as
of Perl 5.13.4,
srand now returns the seed:
srand()returns the seed so you can save it and call it again as