From: Robert Dober Date: 2008-12-02T02:47:54+09:00 Subject: Re: Control Structures I am not sure if you want this optimization a = 3 m = a.times.inject([]){ |r,| x=rand(a); x < (r.last||0) && break; r << x } until m or if you prefer m = a.pred.times.inject( [rand( a )]){ |r,| x=rand(a); x < r.last && break; r << x } until m now apart of not creating the full array when it is already unsorted it is also a brain teaser to work all those new methods out, but that is the beauty of Ruby. P.S Ruby 1.8.7 needed works with PL 72 and 1.9 of course. Cheers Robert