Created
December 15, 2017 11:31
-
-
Save lizmat/d8da65dfea8d223f4c673f6e61656a25 to your computer and use it in GitHub Desktop.
adventofcode #15 part of solution?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub generator(int $init, int $times, int $modulo) { | |
my int $value = $init; | |
-> { ($value = ($value * $times) % $modulo) +& 65535 } | |
} | |
my $a = generator(65, 16807, 2147483647); | |
my $b = generator(8921, 48271, 2147483647); | |
my int $count; | |
++$count if $a() == $b() for ^40_000_000; | |
say $count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment