use of org.h2.dev.hash.MinimalPerfectHash.LongHash in project h2database by h2database.
the class TestPerfectHash method testMinimal.
private int testMinimal(int size) {
Random r = new Random(size);
HashSet<Long> set = new HashSet<>(size);
while (set.size() < size) {
set.add((long) r.nextInt());
}
LongHash hf = new LongHash();
byte[] desc = MinimalPerfectHash.generate(set, hf);
int max = testMinimal(desc, set, hf);
assertEquals(size - 1, max);
return desc.length * 8;
}