Hello,
 The only difference is that the sampling here is only possible for one
element. The distinction would be to get a specific count of random
elements back and even better to do so as a permutation rather than just
a combination. Good day.

Yemi Bedu

P&R Fasteners
325 Pierce St
Somerset, NJ 08873
732-302-3600

-----Original Message-----
From: Thomas Enebo [mailto:Thomas.Enebo / Sun.COM] 
Sent: Friday, August 01, 2008 1:54 PM
To: ruby-core / ruby-lang.org
Subject: [ruby-core:18056] Re: New array methods cycle, choice, shuffle
(plus bug in cycle)

Jim Weirich wrote:
> On Jul 31, 2008, at 7:33 PM, Charles Oliver Nutter wrote:
>
>> choice is a noun. choose, map, select, collect, etc are imperative 
>> verbs.
>
>
> Interesting.  I tend to prefer nouns for methods returning values and 
> verbs for methods called mainly for side effects.  But obviously the 
> Ruby library doesn't follow my preferred conventions. :)
>
I vote for Jim's naming conventions :)  Seriously though... Array.first 
is a noun.  Array.choice is also a noun.  I think from a convention 
standpoint this is ok.

It seems that most of the problem with choice is that the name does not 
adequately describe what it returns.  So it looks strange at first 
glance.  You could say 'random' would be a good CHOICE, but If I saw:

arr.random

I would assume a randomized array based on name.  Picking a good name is

tough.  Picking a better name is not so easy.  Array.give_me_something

If I had my way...I would remove it since it seems like Array already 
has too many esoteric methods in it.  Isn't this method just 
arr[rand(arr.length)]?

-Tom