From: Lars Christensen Date: 2008-05-26T18:44:30+09:00 Subject: Re: briefest method of generating a list of random numbers? On May 26, 11:16 am, Mikael Høilund wrote: > On May 26, 2008, at 10:45, Boris Schmid wrote: > > > Hi all, > > > I wondered if there was a more compact method of generating things > > like > > a random string, or a random list of numbers than I'm using now (using > > ruby 1.9.0-1) > > Array(100) { rand } Don't you mean Array.new(100) { rand } Array(arg) creates an array equal to 'arg' (if it responds to .to_ary) or an array containing precisly 'arg' otherwise. It never yields. There is also (1..100).map { rand } And for strings (1..100).map { (rand(26)+97).chr }.join Lars