Miller Rabin Primality Test

I’m getting a few testcases wrong.

Actually sometimes I’m getting the right answer and sometimes I

*am not. Maybe because of the random number generation

Hey @aiman.mumtaz
Your code is correct and your reason for the failure is also correct
Great work
So these test are only based on probability. And they can create false negatives. i.e miller rabin may say that the number is prime, but it may be prime. These are probabilistic test.
If you need 100 score. Fermat primality test gives accurate result in these test cases, but these are just based on luck I guess. There will be cases where these tests may give false negatives.
Here is the code for fermat primality

If your doubt is resolved please close it