in reply to RE: RE: Randomly Choose an Element from an Array
in thread Randomly Choose an Element from an Array

Your code continues to scare me. What's with the int functions when subscripting already forces an integer? And why do you continue to use $n * rand() when rand($n) does the same thing? And are you sure your randl function always returns a value within the range of the array subscripts? I think it can return negative numbers at first glance, which would then access the ending array elements overly often.

In short, thanks for wanting to contribute, but please get a little more Perl experience under your belt, so we don't have to steer others away from your code. If you want, please preview your post by emailing it to me, and I'll be happy to provide you with suggestions.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: RE: RE: Randomly Choose an Element from an Array