Class: Array

Inherits:
Object show all
Defined in:
lib/rbkb/extends.rb

Instance Method Summary collapse

Instance Method Details

#rand_elemObject

Returns a randomly chosen element from self. Drew is sparta.



582
# File 'lib/rbkb/extends.rb', line 582

def rand_elem;  self[rand(self.length)] ; end

#randomizeObject

randomizes the order of contents in the Array (self)



578
# File 'lib/rbkb/extends.rb', line 578

def randomize  ; self.sort_by { rand } ; end