I’ve only seen something like rand(1..5) work in MRI ruby 1.9.3 (haven’t tried 1.9.2). Jruby doesn’t support it, even in 1.9 mode – it raises a TypeError.
Even ruby-doc doesn’t mention that Ranges are supported. What’s the official behavior?
UPDATE
Well as the answers and comments point out, only 1.9.3 supports it. Jruby is only at 1.9.2.
The docs do say that it is supported
It’s also in the 1.9.3 changelog