my $Y = 0; my @T = (0) x $M; sub shuffle { ($Y, $T[$Y]) = ($T[$Y], lcrng()); return ($Y); }