From: Christoph Rippel Date: 2001-03-08T10:48:37+09:00 Subject: [ruby-talk:12253] Order of hash.keys ... Hi, I run a little experiment on the ambiguity of of order of hash.keys of equal hashes which I think is sort of interesting ... Christoph ----------------- $ time ruby se.rb 0.99804182 0.00195818 509.6782829 99804182 195818 99804182 real 130m19.083s user 128m45.428s sys 0m0.120s ----------------- class A def find e,o,l,r = A::new,A::new,{},{} while (l.keys == r.keys) do e,o = A::new,A::new l = {e => o, o => e} r = { o => e, e => o } end return l,r end def counter m c,d = 0, 0 e,o,l,r = A::new,A::new,{},{} m.times do e,o = A::new,A::new l = {e => o, o => e} r = { o => e, e => o } if (l.keys == r.keys) c+=1 else d+=1 end end p c / m.to_f, d / m.to_f, c / d.to_f p c, d, c end end A.new.counter 10**8