| 1 | package UUID::Random::Secure; | ||
| 2 | |||
| 3 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 4 | 1 | our $DATE = '2021-01-24'; # DATE | |
| 5 | 1 | our $DIST = 'UUID-Random-Secure'; # DIST | |
| 6 | 1 | our $VERSION = '0.004'; # VERSION | |
| 7 | |||
| 8 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use Math::Random::Secure qw(irand); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 0 | ▶ | sub generate { |
|
Subroutine
generate: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 13 | 0 | sprintf( | |
| 14 | "%08x-%04x-%04x-%04x-%04x%08x", | ||
| 15 | irand(), | ||
| 16 | irand(2**16), | ||
| 17 | irand(2**16) , | ||
| 18 | irand(2**16) , | ||
| 19 | irand(2**16), irand(), | ||
| 20 | ); | ||
| 21 | } | ||
| 22 | |||
| 23 | 0 | ▶ | sub generate_rfc { |
|
Subroutine
generate_rfc: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | 0 | sprintf( | |
| 25 | "%08x-%04x-%04x-%04x-%04x%08x", | ||
| 26 | irand(), | ||
| 27 | irand(2**16), | ||
| 28 | irand(2**16) & 0x00ff | 0x4000, | ||
| 29 | irand(2**16) & 0xbfff | 0x8000, | ||
| 30 | irand(2**16), irand(), | ||
| 31 | ); | ||
| 32 | } | ||
| 33 | |||
| 34 | 1 | 1; | |
| 35 | # ABSTRACT: Like UUID::Random, but uses Math::Random::Secure for random numbers | ||
| 36 | |||
| 37 | __END__ | ||