public function testHashDistributionWithCrc32Hasher()
{
$hashSpace = new Flexihash(new Crc32Hasher());
foreach (range(1, $this->_targets) as $i) {
$hashSpace->addTarget("target{$i}");
}
$results = array();
foreach (range(1, $this->_lookups) as $i) {
$results[$i] = $hashSpace->lookup("t{$i}");
}
$distribution = array();
foreach ($hashSpace->getAllTargets() as $target) {
$distribution[$target] = count(array_keys($results, $target));
}
echo sprintf("\nDistribution of %d lookups per target (min/max/median/avg): %d/%d/%d/%d \n", $this->_lookups / $this->_targets, min($distribution), max($distribution), round($this->_median($distribution)), round(array_sum($distribution) / count($distribution)));
}