Just for completeness, this pure perl version should also work:
{
my $seed;
sub ppSrand{ $seed = int( $_[ 0 ] & 32767 ); }
sub ppRand{
my $max = shift // 1;
$seed = ( $seed * 214013 + 2531011 );
return ( ( $seed >> 16 ) & 32767 ) / 32768 * $max; ## Amend
+ed per post below.
}
}
ppSrand( 555 );
print int ppRand( 1000 );
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
|