in reply to rand() function on Windows systems
Running your code on my Windows box, with ActiveState Perl v5.16.3, I get 56:
On the same Windows platform, running Perl v5.14.4 under Cygwin, I get 466:C:\Users\Laurent>perl -e "srand(555); my $range = 1000; my $number = i +nt(rand($range)); print $number ;" 56
If you really need the same pseudo-random numbers as on you old Perl version, then run your old Perl version, write the pseudo-numbers generated to a file and use the numbers in this file on your new version.Laurent@Laurent-HP ~ $ perl -e 'srand(555); > my $range = 1000; > my $number = int(rand($range)); > print $number,"\n";' 466
But the bottom line is, IMHO, that you should probably not try to rely on a random number generator to give you always the same sequence of numbers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: rand() function on Windows systems
by LanX (Saint) on Dec 30, 2016 at 20:37 UTC | |
by Laurent_R (Canon) on Dec 30, 2016 at 21:49 UTC | |
|
Re^2: rand() function on Windows systems
by stevieb (Canon) on Dec 30, 2016 at 20:40 UTC | |
by Laurent_R (Canon) on Dec 30, 2016 at 21:56 UTC | |
by bakiperl (Beadle) on Dec 31, 2016 at 04:36 UTC | |
by AnomalousMonk (Archbishop) on Dec 31, 2016 at 05:34 UTC | |
by stevieb (Canon) on Dec 30, 2016 at 22:39 UTC |