Version: 5.2

## Miller-Rabin Primality Tester

(require (planet djhaskin987/miller-rabin:1:3)) |

Provides the function "prime?" which takes a number N and the number of times to test it K and returns whether the number N is (probably) prime. The probability of its truth is (1 - 1 / (4^K)).

(prime? x k rng) → (boolean?) x : integer? k : integer? rng : (-> exact-positive-integer? exact-nonnegative-integer?)

Given an integer x,
The number of tests to perform k,
and a random number generator rng,
which takes a number and returns a number between 0 and the given number.
NOTE: the default rng is random, which takes as its maximum
value 4294967087.