mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
array.rb: show examples whether Array#shuffle!
has side effect or not
Partially revert 54fb8fb62a
This commit is contained in:
parent
fa3670e6e4
commit
a02ba60466
1 changed files with 4 additions and 2 deletions
2
array.rb
2
array.rb
|
@ -5,6 +5,7 @@ class Array
|
|||
# Shuffles the elements of +self+ in place.
|
||||
# a = [1, 2, 3] #=> [1, 2, 3]
|
||||
# a.shuffle! #=> [2, 3, 1]
|
||||
# a #=> [2, 3, 1]
|
||||
#
|
||||
# The optional +random+ argument will be used as the random number generator:
|
||||
# a.shuffle!(random: Random.new(1)) #=> [1, 3, 2]
|
||||
|
@ -18,6 +19,7 @@ class Array
|
|||
# Returns a new array with elements of +self+ shuffled.
|
||||
# a = [1, 2, 3] #=> [1, 2, 3]
|
||||
# a.shuffle #=> [2, 3, 1]
|
||||
# a #=> [1, 2, 3]
|
||||
#
|
||||
# The optional +random+ argument will be used as the random number generator:
|
||||
# a.shuffle(random: Random.new(1)) #=> [1, 3, 2]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue