summaryrefslogtreecommitdiff
path: root/array.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-22 14:08:05 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-22 14:17:09 +0900
commitf8bf766877782468c4da8c1cecaf21ce9eac3684 (patch)
tree7b1a654316aeafce86cab7726df1711a3be49939 /array.rb
parent13bb16f41edb4682f76d02a9bf2e4d65b443dcf8 (diff)
[DOC] Additional to Array#sample [ci skip]
* The requirement to the +n+ argument. * The order of the result array. [Misc #14147]
Diffstat (limited to 'array.rb')
-rw-r--r--array.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/array.rb b/array.rb
index a43a3b27b1..05ce60773e 100644
--- a/array.rb
+++ b/array.rb
@@ -49,6 +49,8 @@ class Array
# But +self+ may contain duplicates:
# a = [1, 1, 1, 2, 2, 3]
# a.sample(a.size * 2) # => [1, 1, 3, 2, 1, 2]
+ # The argument +n+ must be a non-negative numeric value.
+ # The order of the result array is unrelated to the order of +self+.
# Returns a new empty \Array if +self+ is empty.
#
# The optional +random+ argument will be used as the random number generator: