Guest User

Untitled

a guest
Jun 21st, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. 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)
  2.  
  3. ✔returns only the values present in the array passed to the methodRSpec::Expectations::ExpectationNotMetErrorexpected [1418, 622, 544, 507] to include 0
  4.  
  5. def random_select(array, n)
  6. numbers = n.times.map{ Random.rand(array.length) }
  7. numbers.each do |x|
  8. puts array[x]
  9. end
  10. end
Advertisement
Add Comment
Please, Sign In to add comment