line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NIP::Generator; |
2
|
|
|
|
|
|
|
$NIP::Generator::VERSION = '1.24'; |
3
|
|
|
|
|
|
|
#----------------------------------------------------------------------- |
4
|
3
|
|
|
3
|
|
143446
|
use warnings; |
|
3
|
|
|
|
|
28
|
|
|
3
|
|
|
|
|
95
|
|
5
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
71
|
|
6
|
3
|
|
|
3
|
|
14
|
use base qw( Exporter::Tiny ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1464
|
|
7
|
|
|
|
|
|
|
#======================================================================= |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw( nip ); |
9
|
|
|
|
|
|
|
#======================================================================= |
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
1
|
86
|
return bless { }, $_[ 0 ]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
#======================================================================= |
14
|
|
|
|
|
|
|
sub nip { |
15
|
2
|
|
|
2
|
0
|
103
|
my @vec = qw( 6 5 7 2 3 4 5 6 7 ); |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
4
|
while( 1 ){ |
18
|
2
|
|
|
|
|
7
|
my @val = map { int( rand 10 ) } @vec; |
|
18
|
|
|
|
|
104
|
|
19
|
2
|
|
|
|
|
5
|
my $sum = 0; |
20
|
2
|
|
|
|
|
12
|
$sum += $_ for map { $vec[ $_ ] * $val[ $_ ] } 0 .. $#vec; |
|
18
|
|
|
|
|
42
|
|
21
|
2
|
|
|
|
|
7
|
$sum %= 11; |
22
|
2
|
50
|
|
|
|
24
|
return join( q[], @val, $sum ) if $sum != 10; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
#======================================================================= |
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |