Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/extensions/array.rb
Instance Method Summary collapse
Instance Method Details
#random ⇒ Object
2 3 4 |
# File 'lib/extensions/array.rb', line 2 def random self[Kernel.rand(size)] end |
#random_subset(len = 2) ⇒ Object
6 7 8 9 10 |
# File 'lib/extensions/array.rb', line 6 def random_subset(len=2) rs = [] len.times { rs << random } rs end |