emilio has asked for the wisdom of the Perl Monks concerning the following question:
Not sure if I have found a bug with the rand() function under mod_perl.
#!/usr/bin/perl use CGI; my $query = new CGI; print $query->header; print "hello<br>"; main(); sub main { my $counter = int(rand(1e12)); print $counter; }
PROBLEM:
if run enough times on an apache webserver running mod_perl, -ie. refreshing 15, 20 times- numbers start repeating. I would assume that some internal variable in the function does not get initialized everytime the code is run?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: random function bug on mod_perl
by emilio (Initiate) on Apr 02, 2017 at 20:00 UTC | |
by Anonymous Monk on Apr 02, 2017 at 20:21 UTC | |
by stevieb (Canon) on Apr 02, 2017 at 20:01 UTC |