From 57264a4fae07ab1caca704519c1f426145eafe93 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 16 Jul 2009 05:10:18 +0000 Subject: * array.c (rb_ary_sample): RDoc update. a patch from Florian Frank. [ruby-core:24347] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 52981a2b4f..b9b60c8736 100644 --- a/array.c +++ b/array.c @@ -3526,9 +3526,11 @@ rb_ary_shuffle(VALUE ary) * array.sample -> obj * array.sample(n) -> an_array * - * Choose a random element, or the random +n+ elements, from the array. - * If the array is empty, the first form returns nil, and the - * second form returns an empty array. + * Choose a random element or +n+ random elements from the array. The elements + * are chosen by using random and unique indices into the array in order to + * ensure that an element doesn't repeat itself unless the array already + * contained duplicate elements. If the array is empty the first form returns + * nil and the second form returns an empty array. * */ -- cgit v1.2.3