pseudo-shuffle
Version:
Make the index look like it is shuffled according to the range so that it is not conflicted without the actual shuffle.
22 lines (19 loc) • 461 B
text/typescript
// @ts-ignore
import { encode, decode } from "pseudo-shuffle";
describe("pseudo-shuffle", () => {
it("Should be same value (-8 ~ 102)", () => {
for (let index = -8; index <= 102; index++) {
const encoded = encode({
min: -5,
max: 100,
index,
});
const decoded = decode({
min: -5,
max: 100,
index: encoded,
});
expect(decoded).toBe(index);
}
});
});