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