Ruby Forum Ruby-core > [Bug #455] Array#sample(n) loops if a > arr.size

Posted by Dave Thomas (Guest)
on 19.08.2008 16:14
(Received via mailing list)
Bug #455: Array#sample(n) loops if a > arr.size
http://redmine.ruby-lang.org/issues/show/455

Author: Dave Thomas
Status: Open, Priority: Normal
Category: core

Try:

[1].sample(2)