Algorithm-Numerical-Sample
view release on metacpan or search on metacpan
-sample_size => 100);
$sampler = Algorithm::Numerical::Sample::Stream -> new;
while (<>) {$sampler -> data ($_)}
$random_line = $sampler -> extract;
DESCRIPTION
This package gives two methods to draw fair, random samples from a set.
There is a procedural interface for the case the entire set is known,
and an object oriented interface when the a set with unknown size has to
be processed.
A: "sample (set => ARRAYREF [,sample_size => EXPR])"
The "sample" function takes a set and a sample size as arguments. If the
sample size is omitted, a sample of 1 is taken. The keywords "set" and
"sample_size" may be preceeded with an optional "-". The function
returns the sample list, or a reference to the sample list, depending on
the context.
B: "Algorithm::Numerical::Sample::Stream"
The class "Algorithm::Numerical::Sample::Stream" has the following
lib/Algorithm/Numerical/Sample.pm view on Meta::CPAN
$sampler = Algorithm::Numerical::Sample::Stream -> new;
while (<>) {$sampler -> data ($_)}
$random_line = $sampler -> extract;
=head1 DESCRIPTION
This package gives two methods to draw fair, random samples from a set.
There is a procedural interface for the case the entire set is known,
and an object oriented interface when the a set with unknown size has
to be processed.
=head2 B<A>: C<sample (set =E<gt> ARRAYREF [,sample_size =E<gt> EXPR])>
The C<sample> function takes a set and a sample size as arguments.
If the sample size is omitted, a sample of C<1> is taken. The keywords
C<set> and C<sample_size> may be preceeded with an optional C<->.
The function returns the sample list, or a reference to the sample
list, depending on the context.
=head2 B<B>: C<Algorithm::Numerical::Sample::Stream>
( run in 0.623 second using v1.01-cache-2.11-cpan-8d75d55dd25 )