Sha256: f384d83bb8a54dda36dd81ba7a199df5cd6a613b75f339ccbb75594b20806fce
Contents?: true
Size: 348 Bytes
Versions: 12
Compression:
Stored size: 348 Bytes
Contents
module Array::AtRandom def at_random self[Kernel.rand(length)] unless empty? end end Array.send :include, Array::AtRandom module Array::AtRandom::Etest def test_at_random array = [ 1, 2, 3, 4, 5 ] 5.times do assert array.include?(array.at_random) end assert_equal nil, [].at_random end end if VEX_TEST == "base"
Version data entries
12 entries across 12 versions & 1 rubygems