Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Makes a call to 'rand' or 'Array#shuffle'RSpec::Expectations::ExpectationNotMetErrorexpected false to be trueDoes not return the same input on two consecutive calls (tries 5 times)
- ✔returns only the values present in the array passed to the methodRSpec::Expectations::ExpectationNotMetErrorexpected [1418, 622, 544, 507] to include 0
- def random_select(array, n)
- numbers = n.times.map{ Random.rand(array.length) }
- numbers.each do |x|
- puts array[x]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment