line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Random::NormalDistribution; |
2
|
|
|
|
|
|
|
# coding: UTF-8 |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
34967
|
use utf8; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
39
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
65
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
9
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
50
|
|
12
|
1
|
|
|
1
|
|
5
|
use base qw(Exporter); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
210
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw( |
14
|
|
|
|
|
|
|
rand_nd_generator |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
17
|
1
|
|
|
1
|
|
6
|
use constant TWOPI => 2.0 * 4.0 * atan2(1.0, 1.0); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
367
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub rand_nd_generator(;@) |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
1
|
11
|
my ($mean, $stddev) = @_; |
22
|
1
|
50
|
|
|
|
5
|
$mean = 0.0 if ! defined $mean; |
23
|
1
|
50
|
|
|
|
4
|
$stddev = 1.0 if ! defined $stddev; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return sub { |
26
|
1
|
|
|
1
|
|
871
|
return $mean + $stddev * cos(TWOPI * (1.0 - rand)) * sqrt(-2.0 * log(1.0 - rand)); |
27
|
|
|
|
|
|
|
} |
28
|
1
|
|
|
|
|
8
|
} |
29
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |