From: "David A. Black" Date: 2010-07-18T19:43:58+09:00 Subject: Re: Infinite Loop in Code -- Logic Error Just pasted a small correction to that last pastie. AND... if you don't care what order the people are in, you could actually do this: def self.run spies = get_people_from_file.sort_by { rand } spies.each_with_index do |spy,i| puts "Person #{spy} spies on Person #{spies[i-1]}" end end That randomizes the array up front, and then just pairs people as spy/spyee. Given that approach, you don't need to test for spyability. David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training with Black/Brown/McAnally Compleat Philadelphia, PA, October 1-2, 2010 Rubyist http://www.compleatrubyist.com