PurePerl/RNG/MRMT.pm

filter: Statementstmt 45.4% 15 / 33 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 2 totaltotal 42.3% 22 / 52 SCAR 23.7
CC
5
Cov
39%
new
12.0
rand_32bit
6.0
BEGIN
2.4
CRAP 10.7
« PurePerl.pm ↑ Summary PurePerl/RNG/MRMTPP.pm »
1 package UUID::Generator::PurePerl::RNG::MRMT;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use base qw( UUID::Generator::PurePerl::RNG::Bridge );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 BEGIN {
9 4 ▶ eval q{ use Math::Random::MT };
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine BEGIN: called CC=1 SCAR=1.2
10 4 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 4 0 4
11 4 ▶ *enabled = sub { 0 };
Subroutine __ANON__: called CC=1 SCAR=0.0
12 }
13 else {
14 0 ▶ *enabled = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
15 }
16 }
17  
18 sub new {
19 0 ▶ my $class = shift;
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
20 0 my $seed = shift;
21  
22 0 ▶ $seed = $class->gen_seed_32bit() if ! defined $seed;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $seed 0 0 0
23  
24 0 ▶ if ($class->enabled) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->enabled) { } 0 0 0
25 0 my $mt = Math::Random::MT->new($seed);
26 0 my $self = \$mt;
27 0 return bless $self, $class;
28 }
29 else {
30 0 my $u = undef;
31 0 my $self = \$u;
32 0 return bless $self, $class;
33 }
34 }
35  
36 sub rand_32bit {
37 0 ▶ my $self = shift;
Subroutine rand_32bit: not called CC=2 SCAR=17.9
Pod undocumented
38 0 my $mt = $$self;
39 0 ▶ return 0 if ! $mt;
Branch: 1 branch
BranchTrueFalseTotal
unless $mt 0 0 0
40  
41 0 return int($mt->rand() * 65536.0 * 65536);
42 }
43  
44 4 1;
45 __END__
« PurePerl.pm ↑ Summary PurePerl/RNG/MRMTPP.pm »