Possible Duplicate:
How do I pick randomly from an array?
What is the appropriate way to ensure that a non-existent item isn't chosen?
icons = %w[asterisk star arrow]
random = rand(icons.length)
or
icons = %w[asterisk star arrow]
random = rand(icons.length -1)