Skip to content

Instantly share code, notes, and snippets.

@alherd-by
Created March 23, 2016 10:25
Show Gist options
  • Save alherd-by/dd5919a242a999843caa to your computer and use it in GitHub Desktop.
Save alherd-by/dd5919a242a999843caa to your computer and use it in GitHub Desktop.
<?php
require_once 'HastTable.php';
const LENGTH = 150;
$length = LENGTH;
$division = function ($key) {
return $key % LENGTH;
};
$hastTableDiv = new HastTable($division);
for ($i = 0; $i < 10; $i++) {
$key = random_int(1000000000000, 9999999999999);
$hastTableDiv[$key] = random_int(1, 10);
}
$radixChange = function ($key) {
return (int)base_convert($key, 10, 9) % LENGTH;
};
for ($i = 0; $i < 10; $i++) {
$key = random_int(1000000000000, 9999999999999);
$hastTableRad[$key] = random_int(1, 10);
}
$hastTableRad = new HastTable($radixChange);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment