Project

General

Profile

Bug #1780 ยป ruby-array-sample-docu.patch

flori (Florian Frank), 07/15/2009 11:33 PM

View differences:

array.c (working copy)
* array.sample -> obj
* array.sample(n) -> an_array
*
* Choose a random element, or the random +n+ elements, from the array.
* If the array is empty, the first form returns <code>nil</code>, and the
* second form returns an empty array.
* Choose a random element or +n+ random elements from the array. The elements
* are chosen by using random and unique indices into the array in order to
* ensure that an element doesn't repeat itself unless the array already
* contained duplicate elements. If the array is empty the first form returns
* <code>nil</code> and the second form returns an empty array.
*
*/
    (1-1/1)