Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
Array
/
//opt/alt/ruby21/share/ri/2.1.0/system/Array/sample-i.ri
U:RDoc::AnyMethod[iI"sample:ETI"Array#sample;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CChoose a random element or +n+ random elements from the array.;To:RDoc::Markup::BlankLine o; ; [I"OThe elements are chosen by using random and unique indices into the array ;TI"Oin order to ensure that an element doesn't repeat itself unless the array ;TI"*already contained duplicate elements.;T@o; ; [I"LIf the array is empty the first form returns +nil+ and the second form ;TI"returns an empty array.;T@o; ; [I"MThe optional +rng+ argument will be used as the random number generator.;T@o:RDoc::Markup::Verbatim; [I"+a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ;TI"a.sample #=> 7 ;TI"&a.sample(4) #=> [6, 4, 2, 5];T:@format0: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"�ary.sample -> obj ary.sample(random: rng) -> obj ary.sample(n) -> new_ary ary.sample(n, random: rng) -> new_ary ;T0[ I" (p1);T@ FI" Array;TcRDoc::NormalClass00