Randomization core extension methods.
This library extends Array, String and Hash with randomization methods. Most of the methods are of one of two kinds. Either they “pick” a random element from the reciever or they randomly “shuffle” the reciever.
The most common example is Array#shuffle, which simply randmomizes the order of an array’s elements.
[1,2,3].shuffle #=> [2,3,1]
The other methods do similar things for their respective classes.
# File lib/more/facets/random.rb, line 66 66: def self.append_features(mod) 67: if mod == ::Object 68: mod.send(:include, Random::Object) 69: elsif mod == ::Range 70: mod.send(:include, Random::Range) 71: elsif mod == ::Array 72: mod.send(:include, Random::Array) 73: elsif mod == ::Hash 74: mod.send(:include, Random::Hash) 75: elsif mod == ::String 76: mod.send(:include, Random::String) 77: else 78: raise TypeError 79: end 80: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.