line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Array::Sample::SimpleRandom::Scan; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
53756
|
use 5.010001; |
|
1
|
|
|
|
|
10
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
128
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
10
|
|
|
|
|
|
|
our $DATE = '2022-05-20'; # DATE |
11
|
|
|
|
|
|
|
our $DIST = 'Array-Sample-SimpleRandom'; # DIST |
12
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(sample_simple_random_no_replacement); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub sample_simple_random_no_replacement { |
17
|
5
|
|
|
5
|
1
|
3205
|
require Array::Pick::Scan; |
18
|
|
|
|
|
|
|
|
19
|
5
|
|
|
|
|
353
|
my ($ary, $n) = @_; |
20
|
5
|
|
|
|
|
12
|
Array::Pick::Scan::random_item($ary, $n); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
# ABSTRACT: Simple random sampling from an array (scan algorithm) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |