From: Robert Dober Date: 2008-05-26T20:12:01+09:00 Subject: Re: briefest method of generating a list of random numbers? On Mon, May 26, 2008 at 12:39 PM, S2 wrote: > 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) > > ("a".."z").sort_by {rand}.join this is not really the same, maybe (("a".."z").to_a * N).sort_by { rand }[0..x].join does what OP wants (if N is large enough) and although this approach has a certain elegance it would be very,very inefficent. Cheers R. > > -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein