in reply to Re: Re: Random string generator
in thread Random string generator

Don't forget to add that using a floating point number as an array index, does an implied int on the value. In other words: it truncates towards zero. $a[5.9] is the same array element as $a[5], not $a[6].

A very explicit version would have been:

$chars[int rand scalar @chars]
which does exactly the same thing as
$chars[rand @chars]
The net effect is that all array indexes have the same change of being chosen.