File Coverage

blib/lib/Test/RandomCheck/PRNG.pm
Criterion Covered Total %
statement 12 12 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod 0 3 0.0
total 20 24 83.3


line stmt bran cond sub pod time code
1             package Test::RandomCheck::PRNG;
2 4     4   13 use strict;
  4         4  
  4         82  
3 4     4   11 use warnings;
  4         4  
  4         370  
4              
5 229     229 0 492 sub new { $_[0] }
6              
7 57011     57011 0 138605 sub next_rand { rand() }
8              
9             sub next_int {
10 57011     57011 0 36946 my $self = shift;
11 57011 50       70101 my ($min, $max) = @_ == 2 ? @_ : (0, @_);
12 57011 100       70737 ($min, $max) = ($max, $min) if $min > $max;
13 57011         52748 int($self->next_rand * ($max - $min + 1)) + $min;
14             }
15              
16             1;
17             __END__