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 );
In reply to Re^3: rand() function on Windows systems (pure Perl)
by BrowserUk
in thread rand() function on Windows systems
by bakiperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |