| 1 | package Math::SimpleHisto::XS::RNG; | ||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 11 | our $VERSION = '0.01'; | |||||||||||
| 6 | |||||||||||||
| 7 | 11 | our $Gen = __PACKAGE__->new(_seed()); | |||||||||||
| 8 | |||||||||||||
| 9 | 11 | ▶ | sub _seed { | ||||||||||
|
Subroutine
_seed: called CC=3 SCAR=11.0
| |||||||||||||
| 10 | 11 | my $x; | |||||||||||
| 11 | 11 | ▶ | my @refs = (\$x, [], {}, sub {}); # yeah, random is different :( | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 11 | my @ints = (time, $$); | |||||||||||
| 13 | 11 | foreach my $ref (@refs) { | |||||||||||
| 14 | 44 | $ref = "$ref"; | |||||||||||
| 15 | 44 | ▶ | $ref =~ s/^\w+\(0x(\w+)\)$/$1/ or next; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 16 | 44 | $ref = unpack("h*", $ref); | |||||||||||
| 17 | 44 | $ref = $ref % 2**31; | |||||||||||
| 18 | 44 | push @ints, $ref; | |||||||||||
| 19 | } | ||||||||||||
| 20 | 11 | return @ints; | |||||||||||
| 21 | } | ||||||||||||
| 22 | |||||||||||||
| 23 | |||||||||||||
| 24 | 14 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 25 | 14 | my $class = shift; | |||||||||||
| 26 | 14 | ▶ | if (@_ == 1) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 3 | return setup(shift); # XS | |||||||||||
| 28 | } | ||||||||||||
| 29 | else { | ||||||||||||
| 30 | 11 | return setup_array(@_); # XS | |||||||||||
| 31 | } | ||||||||||||
| 32 | } | ||||||||||||
| 33 | |||||||||||||
| 34 | 2 | ▶ | sub rand { | ||||||||||
|
Subroutine
rand: called CC=5 SCAR=16.6
Pod
undocumented
| |||||||||||||
| 35 | 2 | my ($self, $x) = @_; | |||||||||||
| 36 | 2 | ▶ | if (ref $self) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 1 | ▶ | return ($x || 1) * $self->genrand(); | ||||||||||
|
Condition50%1/2
$x || 1
MC/DC0%0/1
$x || 1
$x
Truth table50%1/2
A
A= $x
| |||||||||||||
| 38 | } | ||||||||||||
| 39 | else { | ||||||||||||
| 40 | 1 | $x = $self; | |||||||||||
| 41 | 1 | ▶ | $Gen = __PACKAGE__->new(_seed()) if not defined $Gen; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 42 | 1 | ▶ | return ($x || 1) * $Gen->genrand(); | ||||||||||
|
Condition50%1/2
$x || 1
MC/DC0%0/1
$x || 1
$x
Truth table50%1/2
A
A= $x
| |||||||||||||
| 43 | } | ||||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 11 | 1; | |||||||||||