Get multiple random array elements in ruby
You can pass an integer argument to .sample to get multiple random elements from an array in ruby
["this", "is", "a", "til", "post"].sample(2)
# => ["this", "post"]
Tweet
You can pass an integer argument to .sample to get multiple random elements from an array in ruby
["this", "is", "a", "til", "post"].sample(2)
# => ["this", "post"]
Tweet