in reply to Re: Non-deterministic Testing (srand)
in thread Non-deterministic Testing

Caveat: this will make the tests reproducible only as long as you keep using the same platform (or perhaps even perl version, or compilation option). For example, the following program
perl -le "srand(0); print rand"
gives me the following results:
0.00115966796875   v5.8.4 built for MSWin32-x86-multi-thread
0.17082803610629   v5.8.0 built for i686-linux

Replies are listed 'Best First'.
Re^3: Non-deterministic Testing (srand)
by BUU (Prior) on Jan 28, 2005 at 19:16 UTC
    And of course we can fix this with the following code:
    BEGIN { my @list = 1..100; #or whatever; *CORE::GLOBAL::rand = sub { return shift @list } #or something }
    and now your rand will return what ever you want it to.