| 1 | # -*- Perl -*- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # returns Pseudo Random Distribution random functions | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Game::PseudoRand; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use 5.10.0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | our @EXPORT_OK = qw(prd_bistep prd_step prd_bitable prd_table); | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | our $VERSION = '0.03'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | sub HIT () { 1 } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | sub MISS () { 0 } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | sub prd_bistep { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prd_bistep: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | my %param = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | croak "need start step_hit step_miss values" | ||||||||||||||||||||||||||||||||||||||||||
| 24 | unless exists $param{start} | ||||||||||||||||||||||||||||||||||||||||||
| 25 | and exists $param{step_hit} | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | ▶ | and exists $param{step_miss}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
exists $param{"start"} and exists $param{"step_hit"} and exists $param{"step_miss"}
exists $param{"start"} and exists $param{"step_hit"}
MC/DC66%2/3
exists $param{"start"} and exists $param{"step_hit"} and exists $param{"step_miss"}
exists $param{"start"}
exists $param{"step_hit"}
exists $param{"step_miss"}
Truth table75%3/4
A and B and C
A= exists $param{"start"}B= exists $param{"step_hit"}C= exists $param{"step_miss"}
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | croak "rand must be a code ref" | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | if defined $param{rand} and ref $param{rand} ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
MC/DC100%2/2
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
defined $param{"rand"}
ref $param{"rand"} ne "CODE"
Truth table100%3/3
A and B
A= defined $param{"rand"}B= ref $param{"rand"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | my $odds = $param{start}; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | my $rand = $param{rand} // sub { CORE::rand }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$param{"rand"} // sub {
rand;
}
MC/DC0%0/2
$param{"rand"} // sub {
rand;
}
$param{"rand"}
sub {
rand;
}
Truth table66%2/3
A // B
A= $param{"rand"}B= sub {
rand;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | ( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | if ( &$rand <= $odds ) { $odds += $param{step_hit}; HIT } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | else { $odds += $param{step_miss}; MISS } | |||||||||||||||||||||||||||||||||||||||||
| 34 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub { $odds = $param{start} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | ▶ | sub prd_step { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prd_step: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 12 | my %param = @_; | |||||||||||||||||||||||||||||||||||||||||
| 41 | croak "requires start and step values" | ||||||||||||||||||||||||||||||||||||||||||
| 42 | unless exists $param{start} | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 12 | ▶ | and exists $param{step}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $param{"start"} and exists $param{"step"}
MC/DC100%2/2
exists $param{"start"} and exists $param{"step"}
exists $param{"start"}
exists $param{"step"}
Truth table100%3/3
A and B
A= exists $param{"start"}B= exists $param{"step"}
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | croak "rand must be a code ref" | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 7 | ▶ | if defined $param{rand} and ref $param{rand} ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
MC/DC100%2/2
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
defined $param{"rand"}
ref $param{"rand"} ne "CODE"
Truth table100%3/3
A and B
A= defined $param{"rand"}B= ref $param{"rand"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | my $odds = $param{start}; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 6 | ▶ | my $reset = $param{reset} // $odds; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$param{"reset"} // $odds
MC/DC0%0/2
$param{"reset"} // $odds
$param{"reset"}
$odds
Truth table66%2/3
A // B
A= $param{"reset"}B= $odds
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 6 | ▶ | my $rand = $param{rand} // sub { CORE::rand }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$param{"rand"} // sub {
rand;
}
MC/DC0%0/2
$param{"rand"} // sub {
rand;
}
$param{"rand"}
sub {
rand;
}
Truth table66%2/3
A // B
A= $param{"rand"}B= sub {
rand;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 12 | ▶ | ( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | ▶ | if ( &$rand <= $odds ) { $odds = $reset; HIT } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 8 | else { $odds += $param{step}; MISS } | |||||||||||||||||||||||||||||||||||||||||
| 52 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | sub { $odds = $param{start} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 6 | ); | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 16 | ▶ | sub prd_bitable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prd_bitable: called CC=17 SCAR=28.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 16 | my %param = @_; | |||||||||||||||||||||||||||||||||||||||||
| 59 | croak "need start table_hit table_miss values" | ||||||||||||||||||||||||||||||||||||||||||
| 60 | unless exists $param{start} | ||||||||||||||||||||||||||||||||||||||||||
| 61 | and exists $param{table_hit} | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 16 | ▶ | and exists $param{table_miss}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
exists $param{"start"} and exists $param{"table_hit"} and exists $param{"table_miss"}
exists $param{"start"} and exists $param{"table_hit"}
MC/DC66%2/3
exists $param{"start"} and exists $param{"table_hit"} and exists $param{"table_miss"}
exists $param{"start"}
exists $param{"table_hit"}
exists $param{"table_miss"}
Truth table75%3/4
A and B and C
A= exists $param{"start"}B= exists $param{"table_hit"}C= exists $param{"table_miss"}
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | croak "table_hit must be a not-empty array ref" | ||||||||||||||||||||||||||||||||||||||||||
| 64 | if ref $param{table_hit} ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 12 | ▶ | or !@{ $param{table_hit} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $param{"table_hit"} ne "ARRAY" or not @{$param{"table_hit"};}
MC/DC100%2/2
ref $param{"table_hit"} ne "ARRAY" or not @{$param{"table_hit"};}
ref $param{"table_hit"} ne "ARRAY"
not @{$param{"table_hit"};}
Truth table100%3/3
A or not(B)
A= ref $param{"table_hit"} ne "ARRAY"B= not @{$param{"table_hit"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | croak "table_miss must be a not-empty array ref" | ||||||||||||||||||||||||||||||||||||||||||
| 67 | if ref $param{table_miss} ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 10 | ▶ | or !@{ $param{table_miss} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $param{"table_miss"} ne "ARRAY" or not @{$param{"table_miss"};}
MC/DC100%2/2
ref $param{"table_miss"} ne "ARRAY" or not @{$param{"table_miss"};}
ref $param{"table_miss"} ne "ARRAY"
not @{$param{"table_miss"};}
Truth table100%3/3
A or not(B)
A= ref $param{"table_miss"} ne "ARRAY"B= not @{$param{"table_miss"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | croak "rand must be a code ref" | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 8 | ▶ | if defined $param{rand} and ref $param{rand} ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
MC/DC100%2/2
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
defined $param{"rand"}
ref $param{"rand"} ne "CODE"
Truth table100%3/3
A and B
A= defined $param{"rand"}B= ref $param{"rand"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 7 | ▶ | my $idxhit = $param{index_hit} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$param{"index_hit"} // 0
MC/DC100%1/1
$param{"index_hit"} // 0
$param{"index_hit"}
Truth table100%2/2
A
A= $param{"index_hit"}
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 7 | ▶ | my $idxmiss = $param{index_miss} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$param{"index_miss"} // 0
MC/DC100%1/1
$param{"index_miss"} // 0
$param{"index_miss"}
Truth table100%2/2
A
A= $param{"index_miss"}
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 7 | my $table_hit = [ @{ $param{table_hit} } ]; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 7 | my $table_miss = [ @{ $param{table_miss} } ]; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 7 | ▶ | croak "index_hit outside of table bounds" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$idxhit < 0 or $idxhit >= @$table_hit
MC/DC100%2/2
$idxhit < 0 or $idxhit >= @$table_hit
$idxhit < 0
$idxhit >= @$table_hit
Truth table100%3/3
A or B
A= $idxhit < 0B= $idxhit >= @$table_hit
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | if $idxhit < 0 or $idxhit >= @$table_hit; | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | ▶ | croak "index_miss outside of table bounds" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$idxmiss < 0 or $idxmiss >= @$table_miss
MC/DC100%2/2
$idxmiss < 0 or $idxmiss >= @$table_miss
$idxmiss < 0
$idxmiss >= @$table_miss
Truth table100%3/3
A or B
A= $idxmiss < 0B= $idxmiss >= @$table_miss
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | if $idxmiss < 0 or $idxmiss >= @$table_miss; | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 3 | my $odds = $param{start}; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | ▶ | my $rand = $param{rand} // sub { CORE::rand }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$param{"rand"} // sub {
rand;
}
MC/DC0%0/2
$param{"rand"} // sub {
rand;
}
$param{"rand"}
sub {
rand;
}
Truth table66%2/3
A // B
A= $param{"rand"}B= sub {
rand;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 15 | ▶ | ( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 15 | ▶ | if ( &$rand <= $odds ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 7 | $idxmiss = 0; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 7 | $odds += $table_hit->[ $idxhit++ ]; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | $idxhit %= @$table_hit; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | return HIT; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 8 | $idxhit = 0; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 8 | $odds += $table_miss->[ $idxmiss++ ]; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 8 | $idxmiss %= @$table_miss; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 8 | return MISS; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $odds = $param{start}; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $idxhit = $param{idxhit} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$param{"idxhit"} // 0
MC/DC0%0/1
$param{"idxhit"} // 0
$param{"idxhit"}
Truth table0%0/2
A
A= $param{"idxhit"}
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $idxmiss = $param{idxmiss} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$param{"idxmiss"} // 0
MC/DC0%0/1
$param{"idxmiss"} // 0
$param{"idxmiss"}
Truth table0%0/2
A
A= $param{"idxmiss"}
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 13 | ▶ | sub prd_table { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prd_table: called CC=12 SCAR=24.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 13 | my %param = @_; | |||||||||||||||||||||||||||||||||||||||||
| 104 | croak "need start and table values" | ||||||||||||||||||||||||||||||||||||||||||
| 105 | unless exists $param{start} | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 13 | ▶ | and exists $param{table}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $param{"start"} and exists $param{"table"}
MC/DC50%1/2
exists $param{"start"} and exists $param{"table"}
exists $param{"start"}
exists $param{"table"}
Truth table66%2/3
A and B
A= exists $param{"start"}B= exists $param{"table"}
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | croak "table must be a not-empty array ref" | ||||||||||||||||||||||||||||||||||||||||||
| 108 | if ref $param{table} ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 12 | ▶ | or !@{ $param{table} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $param{"table"} ne "ARRAY" or not @{$param{"table"};}
MC/DC100%2/2
ref $param{"table"} ne "ARRAY" or not @{$param{"table"};}
ref $param{"table"} ne "ARRAY"
not @{$param{"table"};}
Truth table100%3/3
A or not(B)
A= ref $param{"table"} ne "ARRAY"B= not @{$param{"table"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | croak "rand must be a code ref" | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 10 | ▶ | if defined $param{rand} and ref $param{rand} ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
MC/DC100%2/2
defined $param{"rand"} and ref $param{"rand"} ne "CODE"
defined $param{"rand"}
ref $param{"rand"} ne "CODE"
Truth table100%3/3
A and B
A= defined $param{"rand"}B= ref $param{"rand"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 9 | ▶ | my $index = $param{index} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$param{"index"} // 0
MC/DC100%1/1
$param{"index"} // 0
$param{"index"}
Truth table100%2/2
A
A= $param{"index"}
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 9 | my $table = [ @{ $param{table} } ]; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 9 | ▶ | croak "index outside of table bounds" if $index < 0 or $index >= @$table; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$index < 0 or $index >= @$table
MC/DC100%2/2
$index < 0 or $index >= @$table
$index < 0
$index >= @$table
Truth table100%3/3
A or B
A= $index < 0B= $index >= @$table
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 7 | my $odds = $param{start}; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 7 | ▶ | my $reset = $param{reset} // $odds; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$param{"reset"} // $odds
MC/DC0%0/2
$param{"reset"} // $odds
$param{"reset"}
$odds
Truth table66%2/3
A // B
A= $param{"reset"}B= $odds
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 7 | ▶ | my $rand = $param{rand} // sub { CORE::rand }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$param{"rand"} // sub {
rand;
}
MC/DC0%0/2
$param{"rand"} // sub {
rand;
}
$param{"rand"}
sub {
rand;
}
Truth table66%2/3
A // B
A= $param{"rand"}B= sub {
rand;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 20 | ▶ | ( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 20 | ▶ | if ( &$rand <= $odds ) { $odds = $reset; $index = 0; HIT } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 12 | else { $odds += $table->[ $index++ ]; $index %= @$table; MISS } | |||||||||||||||||||||||||||||||||||||||||
| 121 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | sub { $odds = $param{start}; $index = $param{index} // 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Condition50%1/2
$param{"index"} // 0
MC/DC0%0/1
$param{"index"} // 0
$param{"index"}
Truth table50%1/2
A
A= $param{"index"}
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 7 | ); | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 127 | __END__ | ||||||||||||||||||||||||||||||||||||||||||