From: "thoran@..." Date: 2006-03-19T17:33:11+09:00 Subject: Is Your Software Working A Little Too Predictably? Hello, Is Test::Unit always producing 0 errors? I have the solution! Stir in a packet of RandomMethod and "Hey Presto!", a return to the delights of indeterminacy! # RandomMethod mixin # 0.0.6 # by thoran # 20060319 # Raison D'etre: Because I can!? # Acknowledgements: I used a bit of John W. Long's posting to ruby-talk from 2004-07-31 for the random bit although it looks a bit different now. # Changes: It is within a begin-rescue block now, since no parameters are being passed it would sometimes fail and so will now try until it finds a method that works without parameters. module RandomMethod def random_method begin methods = self.methods random_method = methods[rand(methods.size)] self.send(random_method) rescue random_method end end end Perhaps this can be my entry into Ruby Quiz of the Week's as yet unannounced 'quiz': 'Stupidest Ruby Code Ever Competition?' Perl has competitions for obfuscation; how about we go for obtuseness? Actually is there *any* good purpose to this? thoran P.S. I've already started thinking about the next version, or a similar thing, which will automatically randomize methods on object creation or method call using meta-classes...