From: brabuhr@... Date: 2006-11-29T03:07:39+09:00 Subject: Re: rand random. You've got to be kidding On 11/28/06, Smgspices@aol.com wrote: > Surely it must be possible to initialize rand with current date and time. > Documents seem to indicate this is done with rand(0) or srand with no value. I > have tried both methods and I get the same tired old sequence of numbers. I > would write my own random number generator except I don't know how to get a > numeric value out of Time. Can you post the code that isn't working for you? http://www.rubycentral.com/ref/ref_m_kernel.html#rand http://www.rubycentral.com/ref/ref_m_kernel.html#srand > ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"' 0.346093491828657 0.0992270243895501 0.491676115802907 > ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"' 0.11466702118189 0.0119319523512537 0.111031191235015 > ruby -e 'print "#{rand}\t#{rand}\t#{rand}\n"' 0.282694845926778 0.570101702949362 0.303077309354919 > ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"' 0.417022004702574 0.720324493442158 0.000114374817344887 > ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"' 0.417022004702574 0.720324493442158 0.000114374817344887 > ruby -e 'srand(1); print "#{rand}\t#{rand}\t#{rand}\n"' 0.417022004702574 0.720324493442158 0.000114374817344887 > ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"' 0.435994902142004 0.0259262318278913 0.549662477878709 > ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"' 0.435994902142004 0.0259262318278913 0.549662477878709 > ruby -e 'srand(2); print "#{rand}\t#{rand}\t#{rand}\n"' 0.435994902142004 0.0259262318278913 0.549662477878709 > ruby -v ruby 1.8.4 (2005-12-24) [i586-linux]