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:
<code>
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) }
</code>
<results>
[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
</results>
Can you show us the code that didn't work?
Regards, Morton
P.S. Concerning getting a numeric value out of Time:
<code>
Time.now.to_i
</code>
···
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.