From: Smgspices@... Date: 2006-11-29T03:46:08+09:00 Subject: Re: rand random. You've got to be kidding -------------------------------1164739551 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In a message dated 11/28/2006 11:08:19 A.M. US Mountain Standard Tim, brabuhr@gmail.com writes: > 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? I was running the following in SciTE class Dominoes attr_writer :deck def initialize(number) @deck= Array.new 0.upto(number) {|i| 0.upto(i) {|j| @deck.push([i, j])}} end def shuffle! @deck = @deck.sort{rand} p @deck end end a=Dominoes.new(6) a.shuffle! The p @deck was added so I could see what was being done. Every time I press F5 I get exactly the same result: [[6, 6], [4, 4], [0, 0], [5, 0], [1, 1], ... I get the same results if I wait a few minutes or come back the next day. I get exactly the same results when I use fxri and freeRIDE. I am running Ruby version 1.18.4. Charlie -------------------------------1164739551--