line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NIP::Generator; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#----------------------------------------------------------------------- |
4
|
3
|
|
|
3
|
|
120364
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
24
|
|
|
3
|
|
|
|
|
167
|
|
5
|
|
|
|
|
|
|
$VERSION = 1.1; |
6
|
|
|
|
|
|
|
#----------------------------------------------------------------------- |
7
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
74
|
|
8
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
63
|
|
9
|
3
|
|
|
3
|
|
11
|
use base qw( Exporter::Tiny ); |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
1357
|
|
10
|
|
|
|
|
|
|
#======================================================================= |
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( nip ); |
12
|
|
|
|
|
|
|
#======================================================================= |
13
|
|
|
|
|
|
|
sub new { |
14
|
1
|
|
|
1
|
1
|
74
|
return bless { }, $_[ 0 ]; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
#======================================================================= |
17
|
|
|
|
|
|
|
sub nip { |
18
|
2
|
|
|
2
|
0
|
79
|
my @vec = qw( 6 5 7 2 3 4 5 6 7 ); |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
5
|
while( 1 ){ |
21
|
3
|
|
|
|
|
5
|
my @val = map { int( rand 10 ) } @vec; |
|
27
|
|
|
|
|
91
|
|
22
|
3
|
|
|
|
|
6
|
my $sum = 0; |
23
|
3
|
|
|
|
|
8
|
$sum += $_ for map { $vec[ $_ ] * $val[ $_ ] } 0 .. $#vec; |
|
27
|
|
|
|
|
42
|
|
24
|
3
|
|
|
|
|
8
|
$sum %= 11; |
25
|
3
|
100
|
|
|
|
25
|
return join( q[], @val, $sum ) if $sum != 10; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
#======================================================================= |
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |