Skip to content

Commit e3533ea

Browse files
author
Lillian Zhang
committed
Fix self-created bug
1 parent 576a40b commit e3533ea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/ruby/truffleruby/core/array.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,8 @@ def sample(count=undefined, options=undefined)
10291029
count.times do |c|
10301030
result.__send__ :swap, c, rng.rand(size)
10311031
end
1032+
1033+
count == size ? result : result[0, count]
10321034
end
10331035

10341036
private def sample_many_quad(count, rng)

0 commit comments

Comments
 (0)