From: Morton Goldberg Date: 2006-11-29T03:33:42+09:00 Subject: Re: rand random. You've got to be kidding On Nov 28, 2006, at 12:51 PM, 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't reproduce your problem. #srand with no argument seems to seed the pseudo-random number generator with a different value on each call. For example: srand p Array.new(10) { rand(10) } srand(1) p Array.new(10) { rand(10) } srand p Array.new(10) { rand(10) } srand(1) p Array.new(10) { rand(10) } srand p Array.new(10) { rand(10) } [7, 8, 8, 1, 8, 3, 5, 6, 5, 2] [4, 9, 7, 9, 0, 1, 3, 9, 1, 2] [8, 4, 0, 0, 0, 7, 7, 4, 4, 4] [4, 9, 7, 9, 0, 1, 3, 9, 1, 2] [3, 9, 2, 9, 8, 0, 1, 0, 5, 9 Can you show us the code that didn't work? Regards, Morton P.S. Concerning getting a numeric value out of Time: Time.now.to_i