in reply to Re: Randomly picking numbers
in thread Randomly picking numbers

You don't need the int as the subscript is always an integer therefore the index is implicitly converted before being used.

/J\

Replies are listed 'Best First'.
Re^3: Randomly picking numbers
by tlm (Prior) on May 05, 2005 at 13:44 UTC

    ...the index is implicitly converted before being used.

    ...and it does so via truncation:

    % perl -le 'print +(0, 1)[0.999999]' 0
    as opposed to rounding, and that's why it works so well in $arr[rand @arr].

    the lowliest monk