From: Boris Schmid Date: 2008-05-26T18:34:24+09:00 Subject: Re: briefest method of generating a list of random numbers? > But what's wrong with the first - it looks fairly compact to me: > > string = "" ; 100.times { string << (rand(26) + 97).chr} > For strings I'll have to use the one above, but arrays now read a bit more natural (to my eyes). The size doesn't matter that much, but it is simpler to understand. population = Array.new(POP_SIZE) { function_that_generates_a_random_individual } vs the old population = [] ; POP_SIZE.times {population << function_that_generates_a_random_individual } Thanks both of you! -- Posted via http://www.ruby-forum.com/.