# :title: Standard classes extensions
#
# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Copyright:: (C) 2006,2007 Giuseppe Bilotta
-# License:: GPL v2
#
# This file collects extensions to standard Ruby classes and to some core rbot
# classes to be used by the various plugins
end
self.delete_at(index)
end
+
+ # This method shuffles the items in the array
+ def shuffle!
+ base = self.dup
+ self.clear
+ while item = base.delete_one
+ self << item
+ end
+ self
+ end
+
+ # This method returns a new array with the same items as
+ # the receiver, but shuffled
+ def shuffle
+ ret = self.dup
+ ret.shuffle!
+ end
+
end
# Extensions to the Range class