MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / getNParity

Method getNParity

app/src/main/java/cs/min2phase/Util.java:252–259  ·  view source on GitHub ↗
(int idx, int n)

Source from the content-addressed store, hash-verified

250 }
251
252 static int getNParity(int idx, int n) {
253 int p = 0;
254 for (int i = n - 2; i >= 0; i--) {
255 p ^= idx % (n - i);
256 idx /= (n - i);
257 }
258 return p & 1;
259 }
260
261 static void setNPerm(int[] arr, int idx, int n) {
262 arr[n - 1] = 0;

Callers 3

resolvePermMethod · 0.95
randomStateMethod · 0.95
verifyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected