| 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
| |||||||||||
| 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
| |||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | if ($class->enabled) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 40 | |||||||||||
| 41 | 0 | return int($mt->rand() * 65536.0 * 65536); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 4 | 1; | |||||||||
| 45 | __END__ | ||||||||||