2007-08-30から1日間の記事一覧
こちらの方が良いかもしれない。 http://web.comhem.se/~u34308910/emacs.html
追記 これで、偏りが生じるsortなことははっきり分かる。 def myrand (rand+0.5).to_i end p (1..100000).inject(Hash.new(0)){|h,e| h[[1,0].sort_by {myrand}]+=1; h} #結果 #{[1, 0]=>74999, [0, 1]=>25001} 参考までに x=lambda {|arr| arr.each_index {…