From: Boris Schmid Date: 2008-05-26T18:43:44+09:00 Subject: Re: briefest method of generating a list of random numbers? Boris Schmid wrote: >> string = "" ; 100.times { string << (rand(26) + 97).chr} >> > > For strings I'll have to use the one above, Duh. I can just use the Array.new, and append a .join at the end to get the random string. And Axel, I'm generating quite a lot of arrays in my small prog, and using this shorter way makes it indeed clearer :). It is definitly worth it. Example: filter = Array.new(WINDOW) { bucket = Array.new(AMINO) {|i| (97 + i).chr} } was filter = [] WINDOW.times {bucket = [] ; AMINO.times {|i| bucket << (97 + i).chr} ; filter << bucket} -- Posted via http://www.ruby-forum.com/.