line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::RNG::Microsoft; |
2
|
|
|
|
|
|
|
$Math::RNG::Microsoft::VERSION = '0.0.4'; |
3
|
1
|
|
|
1
|
|
71598
|
use 5.006; |
|
1
|
|
|
|
|
11
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use integer; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Class::XSAccessor { |
11
|
1
|
|
|
|
|
6
|
constructor => 'new', |
12
|
|
|
|
|
|
|
accessors => [qw(seed)], |
13
|
1
|
|
|
1
|
|
388
|
}; |
|
1
|
|
|
|
|
1753
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub rand |
16
|
|
|
|
|
|
|
{ |
17
|
12
|
|
|
12
|
1
|
83
|
my $self = shift; |
18
|
12
|
|
|
|
|
21
|
$self->seed(($self->seed() * 214013 + 2531011) & (0x7FFF_FFFF)); |
19
|
12
|
|
|
|
|
24
|
return (($self->seed >> 16) & 0x7fff); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub max_rand |
23
|
|
|
|
|
|
|
{ |
24
|
9
|
|
|
9
|
1
|
11
|
my ($self, $max) = @_; |
25
|
|
|
|
|
|
|
|
26
|
9
|
|
|
|
|
10
|
return ($self->rand() % $max); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub shuffle |
30
|
|
|
|
|
|
|
{ |
31
|
1
|
|
|
1
|
1
|
394
|
my ($self, $deck) = @_; |
32
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
3
|
if (@$deck) |
34
|
|
|
|
|
|
|
{ |
35
|
1
|
|
|
|
|
2
|
my $i = @$deck; |
36
|
1
|
|
|
|
|
2
|
while (--$i) { |
37
|
9
|
|
|
|
|
12
|
my $j = $self->max_rand($i+1); |
38
|
9
|
|
|
|
|
15
|
@$deck[$i,$j] = @$deck[$j,$i]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
2
|
return $deck; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; # End of Math::RNG::Microsoft |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |