From: Ben Stephens Date: 2005-07-20T00:17:36+09:00 Subject: Regarding rand I was reading Learn to Program by Chris Pine yesterday, in one bit it says: ' Note that I used rand(101) to get back numbers from 0 to 100, and that rand(1) always gives back 0.' I was wondering if rand() could support syntax like: rand(0..100) Here's my go: def random(value) if value.class.method_defined? 'entries' entries = value.entries entries[rand(entries.length)] else rand(value) end end this works with arrays and hashes too. I'm coming to Ruby via RoR and i'm loving it, I should be writing a web app and i'm playing with Ruby instead. Ben