summaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-16 05:10:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-16 05:10:18 +0000
commite79c0a97da339e10222d23c7f49472b0e293b14b (patch)
treee9b6efdc39f57ea21589aa11cb44b0bccf3ab462 /array.c
parent2deca670e23a36f402ce5efde3822a9a0465be0c (diff)
downloadruby-e79c0a97da339e10222d23c7f49472b0e293b14b.tar.gz
ruby-e79c0a97da339e10222d23c7f49472b0e293b14b.tar.xz
ruby-e79c0a97da339e10222d23c7f49472b0e293b14b.zip
* array.c (rb_ary_sample): RDoc update. a patch from Florian
Frank. [ruby-core:24347] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/array.c b/array.c
index 52981a2b4..b9b60c873 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 <code>nil</code>, 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
+ * <code>nil</code> and the second form returns an empty array.
*
*/