blib/lib/Test/RandomCheck/PRNG.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 6 | 12 | 50.0 |
branch | 0 | 4 | 0.0 |
condition | n/a | ||
subroutine | 2 | 5 | 40.0 |
pod | 0 | 3 | 0.0 |
total | 8 | 24 | 33.3 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Test::RandomCheck::PRNG; | ||||||
2 | 4 | 4 | 15 | use strict; | |||
4 | 6 | ||||||
4 | 98 | ||||||
3 | 4 | 4 | 14 | use warnings; | |||
4 | 4 | ||||||
4 | 410 | ||||||
4 | |||||||
5 | 0 | 0 | 0 | sub new { $_[0] } | |||
6 | |||||||
7 | 0 | 0 | 0 | sub next_rand { rand() } | |||
8 | |||||||
9 | sub next_int { | ||||||
10 | 0 | 0 | 0 | my $self = shift; | |||
11 | 0 | 0 | my ($min, $max) = @_ == 2 ? @_ : (0, @_); | ||||
12 | 0 | 0 | ($min, $max) = ($max, $min) if $min > $max; | ||||
13 | 0 | int($self->next_rand * ($max - $min + 1)) + $min; | |||||
14 | } | ||||||
15 | |||||||
16 | 1; | ||||||
17 | __END__ |