File Coverage

lib/Crypt/Perl/RNG.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition 2 3 66.6
subroutine 7 7 100.0
pod 0 3 0.0
total 23 27 85.1


line stmt bran cond sub pod time code
1             package Crypt::Perl::RNG;
2              
3 14     14   121 use strict;
  14         79  
  14         528  
4 14     14   83 use warnings;
  14         35  
  14         353  
5              
6 14     14   6622 use Bytes::Random::Secure::Tiny ();
  14         103764  
  14         2030  
7              
8             my %PID_RNG;
9              
10             sub _get {
11 12288   66 12288   54806 return $PID_RNG{$$} ||= Bytes::Random::Secure::Tiny->new();
12             }
13              
14             sub bytes {
15 8     8 0 24 return _get()->bytes(@_);
16             }
17              
18             sub bytes_hex {
19 11844     11844 0 22684 return _get()->bytes_hex(@_);
20             }
21              
22             sub bit_string {
23 436     436 0 1392 my ($count) = @_;
24              
25 436         3070 return _get()->string_from('01', $count);
26             }
27              
28             1;