From: Logan Capaldo Date: 2006-08-06T04:21:08+09:00 Subject: Re: Smoking hash-ish: Letter mapping... On Aug 5, 2006, at 3:07 PM, Meino Christian Cramer wrote: > Oh...there is another issue: > > With encmap=Hash[*('A'..'Z').to_a.sort{rand(2)}] I only will get 13 > instead of 26 mappings! How can I fix /that/ ? > > Keep encoding! :) > mcc > Actually its generally considered better to do sort_by{rand} that sort {rand(2)} If you only want to randomize key or value you can do first = ("A".."Z").to_a second = ("A".."Z").sort_by{rand} encmap = Hash[ *first.zip(second).flatten ]