diff options
author | Yusuke Endoh <[email protected]> | 2020-11-12 16:56:15 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2020-11-12 16:59:59 +0900 |
commit | a02ba60466500639af80e560fbf2311c6db70d8c (patch) | |
tree | 37b704e22b27fbca550d5127cbf97b7739dd0ec3 /array.rb | |
parent | fa3670e6e48a8553ad1f37bbfbd112911da497d1 (diff) |
array.rb: show examples whether `Array#shuffle!` has side effect or not
Partially revert 54fb8fb62a30c7b60ab6443a62821f6f8bc479c4
Diffstat (limited to 'array.rb')
-rw-r--r-- | array.rb | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -4,7 +4,8 @@ class Array # # Shuffles the elements of +self+ in place. # a = [1, 2, 3] #=> [1, 2, 3] - # a.shuffle! #=> [2, 3, 1] + # 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] @@ -17,7 +18,8 @@ class Array # # Returns a new array with elements of +self+ shuffled. # a = [1, 2, 3] #=> [1, 2, 3] - # a.shuffle #=> [2, 3, 1] + # 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] |