Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IsPrime() [2/2]

static bool System.Collections.HashHelpers.IsPrime ( int candidate)
inlinestatic

Definition at line 17 of file HashHelpers.cs.

18 {
19 if (((uint)candidate & (true ? 1u : 0u)) != 0)
20 {
21 int num = (int)Math.Sqrt(candidate);
22 for (int i = 3; i <= num; i += 2)
23 {
24 if (candidate % i == 0)
25 {
26 return false;
27 }
28 }
29 return true;
30 }
31 return candidate == 2;
32 }

References System.Math.Sqrt().