in reply to Re^2: Randomize word
in thread Randomize word
Remove the -1:
sub shuffleWord { my( $l, $p ) = length( $_[0] ); $p = int rand $l - $_ and substr( $_[ 0 ], $_ , 1 ) ^= substr( $_[ 0 ], $_ + $p, 1 ) ^= substr( $_[ 0 ], $_ , 1 ) ^= substr( $_[ 0 ], $_ + $p, 1 ) for 0 .. $l; return $_[ 0 ]; }
|
|---|