27 Jul 2021   ruby


Ruby’s Array#sample method can take an unnamed argument to return more than one random element.

%w[a b c].sample(2)
=> ["a", "c"]
🍄