From: Bob Sanders Date: 2007-08-15T21:20:53+09:00 Subject: Re: How do you choose a random word from an array? Stefano Crocco wrote: > Alle mercoled狸 15 agosto 2007, Bob Sanders ha scritto: >> I'm trying to choose a random word from a given array. A little >> something like this: >> >> christmas_bin = ["candy", "toys", "songs"] >> >> So then, I'd like to choose a random word from it (e.g. "toys"). >> >> I tried christmas_bin.rand, but no luck. >> >> Any ideas? > > christmas_bin[rand(christmas_bin.size)] > > Stefano You're the best, Stefano! Thank you so much! -- Posted via http://www.ruby-forum.com/.