Here’s a one-liner after all:
gsub!(/\B\w+\B/){proc{|s|Array.new(s.length){s.delete_at(rand(
s.length))}}.call($&.split(//)).join}It’s longer for sure, but now you’re sure the result is really random
(provided you believe me it is
Just for clarification, my concerns rested with sort{rand}. The original
one-liners using sort_by{rand} should be fine with regards to randomness.
···
–
– Jim Weirich / Compuware
– FWP Capture Services
– Phone: 859-386-8855