[1,2,3,4].sample # => e.g. 4
If you'd like to cheat and give different weights to each element in the array, you can use the attached initializer to say:
[1,2,3,4].weighted_sample([1,1,1,1000]) # => probably 4
Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.