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)
3526 3526
 *     array.sample        -> obj
3527 3527
 *     array.sample(n)     -> an_array
3528 3528
 *
3529
 *  Choose a random element, or the random +n+ elements, from the array.
3530
 *  If the array is empty, the first form returns <code>nil</code>, and the
3531
 *  second form returns an empty array.
3529
 *  Choose a random element or +n+ random elements from the array. The elements
3530
 *  are chosen by using random and unique indices into the array in order to
3531
 *  ensure that an element doesn't repeat itself unless the array already
3532
 *  contained duplicate elements. If the array is empty the first form returns
3533
 *  <code>nil</code> and the second form returns an empty array.
3532 3534
 *
3533 3535
 */
3534 3536