How the test decides
Miller-Rabin writes n - 1 as 2^s times an odd number d, then computes a^d mod n and its successive squares. The number passes the round for base a if a^d is 1 mod n or one of those squares is n - 1; otherwise n is composite, with certainty. Each additional random base multiplies the chance of wrongly passing by at most 1/4.