#!/usr/bin/perl use warnings; use strict; { my $seed = 0; sub win_srand { $seed = shift } sub win_rand { my ($max) = @_; $seed = ( 214013 * $seed + 2531011 ) & 0xFFFFFFFF; return $max * (($seed >> 16) & 0x7FFF) / (1 << 15) } } win_srand(0); print int(win_rand(99)) for 0..9; # 023647263525973192.
In reply to Re^3: Old random number generator
by choroba
in thread Old random number generator
by Pascal666
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |