summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-04 09:03:20 +0000
committerayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-04 09:03:20 +0000
commit6992be63d89406222e1857ed9b8fa9a7e2c1a1c4 (patch)
tree6c53b1fd9d3a765f71e4a716d9af95d4e3d3350d /array.c
parent460528289ab3b22f373c00a8494f65e5c3dcfdde (diff)
* array.c (rb_ary_sample): add examples for Array#sample.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/array.c b/array.c
index 01cabc87b9..c0ebf66442 100644
--- a/array.c
+++ b/array.c
@@ -3953,6 +3953,10 @@ rb_ary_shuffle(int argc, VALUE *argv, VALUE ary)
* <code>nil</code> and the second form returns an empty array.
*
* If +rng+ is given, it will be used as the random number generator.
+ *
+ * a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
+ * a.sample #=> [7]
+ * a.sample(4) #=> [6, 4, 2, 5]
*/