| 1 | package Math::Partition::Rand; | ||||||||||||||||||||||
| 2 | 2 | our $AUTHORITY = 'cpan:GENE'; | |||||||||||||||||||||
| 3 | |||||||||||||||||||||||
| 4 | # ABSTRACT: Random floating point additive partitions | ||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.0302'; | |||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | 2 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | 2 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||
| 14 | 2 | my $class = shift; | |||||||||||||||||||||
| 15 | 2 | my %args = @_; | |||||||||||||||||||||
| 16 | my $self = { | ||||||||||||||||||||||
| 17 | top => $args{top} || 1, | ||||||||||||||||||||||
| 18 | 2 | ▶ | n => $args{n} || 2, | ||||||||||||||||||||
|
Condition50%2/4
$args{'top'} || 1
$args{'n'} || 2
MC/DC0%0/1
$args{'top'} || 1
$args{'top'}
MC/DC0%0/1
$args{'n'} || 2
$args{'n'}
Truth table50%1/2
A
A= $args{'top'}
Truth table50%1/2
A
A= $args{'n'}
| |||||||||||||||||||||||
| 19 | }; | ||||||||||||||||||||||
| 20 | 2 | bless $self, $class; | |||||||||||||||||||||
| 21 | 2 | return $self; | |||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||
| 23 | |||||||||||||||||||||||
| 24 | |||||||||||||||||||||||
| 25 | 2 | ▶ | sub choose { | ||||||||||||||||||||
|
Subroutine
choose: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||
| 26 | 2 | my $self = shift; | |||||||||||||||||||||
| 27 | |||||||||||||||||||||||
| 28 | 2 | my @distribution; | |||||||||||||||||||||
| 29 | |||||||||||||||||||||||
| 30 | 2 | my $top = $self->{top}; | |||||||||||||||||||||
| 31 | 2 | my $n = $self->{n}; | |||||||||||||||||||||
| 32 | |||||||||||||||||||||||
| 33 | 2 | for my $i ( 1 .. $n ) { | |||||||||||||||||||||
| 34 | 7 | my $curr = rand($top); | |||||||||||||||||||||
| 35 | 7 | my $next = abs( $top - $curr ); | |||||||||||||||||||||
| 36 | |||||||||||||||||||||||
| 37 | 7 | ▶ | push @distribution, $i == $n ? $top : $next; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 38 | |||||||||||||||||||||||
| 39 | 7 | $top = $curr; | |||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 2 | return \@distribution; | |||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||
| 44 | |||||||||||||||||||||||
| 45 | 2 | 1; | |||||||||||||||||||||
| 46 | |||||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||||