ruby-changes:68070
From: Nobuyoshi <ko1@a...>
Date: Wed, 22 Sep 2021 14:19:01 +0900 (JST)
Subject: [ruby-changes:68070] f8bf766877 (master): [DOC] Additional to Array#sample [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=f8bf766877 From f8bf766877782468c4da8c1cecaf21ce9eac3684 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 22 Sep 2021 14:08:05 +0900 Subject: [DOC] Additional to Array#sample [ci skip] * The requirement to the +n+ argument. * The order of the result array. [Misc #14147] --- array.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/array.rb b/array.rb index a43a3b2..05ce607 100644 --- a/array.rb +++ b/array.rb @@ -49,6 +49,8 @@ class Array https://github.com/ruby/ruby/blob/trunk/array.rb#L49 # 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: -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/