Simple question,
What does class Random require?
I tried this code:
r=Random.new(315)
printf("%d\n",r.rand(10))
and go this error:
test.rb:1: uninitialized constant Random (NameError)
spent some time looking in google and google groups but no luck.
It’s a pretty simple problem, maybe somebody here can help me?
TIA
-Tom Z
On Jan 14, 2011, at 7:15 AM, tzthomas1 wrote:
What does class Random require?
I think Ruby 1.9.2.
Jose
…
Jose Hales-Garcia
UCLA Department of Statistics
On Sat, 15 Jan 2011 00:18:34 +0900, Jose Hales-Garcia wrote:
On Jan 14, 2011, at 7:15 AM, tzthomas1 wrote:
What does class Random require?
I think Ruby 1.9.2.
If you can’t user Ruby 1.9.2, then maybe the simple-random gem will do
what you want (http://mendicantbug.com/2010/07/24/simple-random-number-
generator-gem/)
Alternatively, if you’re working in JRuby, you can just instantiate a
java.util.Random