| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::boxmuller; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
46782
|
use 5.006; |
|
|
1
|
|
|
|
|
3
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
14
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
58
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
App::boxmuller - Provides the command which produces Gaussian distributed random numbers, as well as log-normal distributed numbers. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.24 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
boxmuller [B<-m> mean] [B<-v> variance | B<-d> standard_deviation] |
|
22
|
|
|
|
|
|
|
[B<-g> how_many_you_want] [B<-.> digits_after_decimal_point] [B<-s> random_seed] |
|
23
|
|
|
|
|
|
|
[B<-L>(log normal)] [B<-@> seconds] [B<-1>] [B<-:>] |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
boxmuller [B<--help> [ja|en] [opt] [nopod]] [B<--version>] |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Generates Gaussian random variables by Box-Muller method. |
|
30
|
|
|
|
|
|
|
The used random seed and the sums of the generated numbers and the square of them are also |
|
31
|
|
|
|
|
|
|
provided to STDERR. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 OPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over 4 |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item -m N |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Population B. Default value is 0. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item -d N |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Population B. Default value is 1. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item -v N |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Population B. Default value is 1. If -d is given, -v would be nullified. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item -. N |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The digits to be shown after the decimal point. Without this specification |
|
53
|
|
|
|
|
|
|
14 digits after the decimal point may be shown. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item -g N |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
How many numbers to be produced. Default value is 6. "Inf" (Infinity) can be given. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item -s N |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Random B specification. The residual divided by 2**32 is essential. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item -L |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Outputs variables from the B instead of the normal distribution. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item -1 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Only output the random number without other secondary information. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item -: |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Attaches serial number beginning from 1. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item -@ N |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Waiting time in B for each output line, that can be spedicifed 6 digits after the decimal points |
|
78
|
|
|
|
|
|
|
(microsecond). |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item --help |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Print this online help manual of this command "boxmuller". Similar to "perldoc `which [-t] boxmuller` ". |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item --help opt |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Only shows the option helps. It is easy to read when you are in very necessary. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item --help ja |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Shows Japanese online help manual. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item --help nopod |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Print this online manual using the code insdide this program without using the function of Perl POD. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item --version |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Version information output. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 EXAMPLE |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over 4 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item boxmuller |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Generates some random numbers from the stardard normal distribution. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item boxmuller -m 10 -d 2 -g 12 |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Generates 12 random numbers from the normal distribution with the |
|
113
|
|
|
|
|
|
|
population mean 10, the population variance 2. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item boxmuller B<-L> -m 3 -d 2 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Generates B. In this case the popular median is exp(3) = 20.09. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item boxmuller B<-g Inf -@ 0.3> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Generate each random number every 0.3 seconds. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Toshiyuki Shimono |
|
129
|
|
|
|
|
|
|
bin4tsv@gmail.com |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 HISTORY |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This program has been made since 2016-07-07 (Thu) |
|
134
|
|
|
|
|
|
|
as a part of TSV hacking toolset for table data. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 EXPORT |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Nothing would be exported. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 BUGS |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
143
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
144
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SUPPORT |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
perldoc App::boxmuller |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
You can also look for information at: |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over 4 |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * Search CPAN |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
L |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Copyright 2018 "Toshiyuki Shimono". |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify |
|
184
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
185
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
186
|
|
|
|
|
|
|
(at your option) any later version. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
189
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
190
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
191
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
194
|
|
|
|
|
|
|
along with this program. If not, see L. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
1; # End of App::boxmuller |