line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NIP::Generator; |
2
|
|
|
|
|
|
|
$NIP::Generator::VERSION = '1.21'; |
3
|
|
|
|
|
|
|
#----------------------------------------------------------------------- |
4
|
3
|
|
|
3
|
|
146821
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
38
|
|
|
3
|
|
|
|
|
185
|
|
5
|
|
|
|
|
|
|
#----------------------------------------------------------------------- |
6
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
80
|
|
7
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
64
|
|
8
|
3
|
|
|
3
|
|
13
|
use base qw( Exporter::Tiny ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1642
|
|
9
|
|
|
|
|
|
|
#======================================================================= |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( nip ); |
11
|
|
|
|
|
|
|
#======================================================================= |
12
|
|
|
|
|
|
|
sub new { |
13
|
1
|
|
|
1
|
1
|
84
|
return bless { }, $_[ 0 ]; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
#======================================================================= |
16
|
|
|
|
|
|
|
sub nip { |
17
|
2
|
|
|
2
|
0
|
96
|
my @vec = qw( 6 5 7 2 3 4 5 6 7 ); |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
4
|
while( 1 ){ |
20
|
2
|
|
|
|
|
7
|
my @val = map { int( rand 10 ) } @vec; |
|
18
|
|
|
|
|
133
|
|
21
|
2
|
|
|
|
|
10
|
my $sum = 0; |
22
|
2
|
|
|
|
|
20
|
$sum += $_ for map { $vec[ $_ ] * $val[ $_ ] } 0 .. $#vec; |
|
18
|
|
|
|
|
49
|
|
23
|
2
|
|
|
|
|
11
|
$sum %= 11; |
24
|
2
|
50
|
|
|
|
28
|
return join( q[], @val, $sum ) if $sum != 10; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
#======================================================================= |
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |