HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/ri/3.0.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")Returns random elements from +self+.;To:RDoc::Markup::BlankLineo;
;	[I"GWhen no arguments are given, returns a random element from +self+:;To:RDoc::Markup::Verbatim;	[I")a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
;TI"a.sample # => 3
;TI"a.sample # => 8
;T:@format0o;
;	[I"'If +self+ is empty, returns +nil+.;T@o;
;	[I"LWhen argument +n+ is given, returns a new \Array containing +n+ random ;TI"elements from +self+:;To;;	[I" a.sample(3) # => [8, 9, 2]
;TI"*a.sample(6) # => [9, 6, 10, 3, 1, 4]
;T;
0o;
;	[I"3Returns no more than <tt>a.size</tt> elements ;TI"0(because no new duplicates are introduced):;To;;	[I"?a.sample(a.size * 2) # => [6, 4, 1, 8, 5, 9, 10, 2, 3, 7]
;T;
0o;
;	[I"'But +self+ may contain duplicates:;To;;	[I"a = [1, 1, 1, 2, 2, 3]
;TI"2a.sample(a.size * 2) # => [1, 1, 3, 2, 1, 2]
;T;
0o;
;	[I"3Returns a new empty \Array if +self+ is empty.;T@o;
;	[I"PThe optional +random+ argument will be used as the random number generator:;To;;	[I")a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
;TI"/a.sample(random: Random.new(1))     #=> 6
;TI":a.sample(4, random: Random.new(1))  #=> [6, 10, 9, 2];T;
0:
@fileI"
array.rb;T:0@omit_headings_from_table_of_contents_below0I"Warray.sample(random: Random) -> object
array.sample(n, random: Random) -> new_ary
;T0[I"((n = (ary = false), random: Random);T@;FI"
Array;TcRDoc::NormalClass00