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::BlankLineo; ; [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