You may have heard about an algorithm called “provability” which is commonly used at online gambling websites.

Provability means “provable” + “probability”, that means all lucky numbers created by the provider are provable.

Here is a sample PHP code to create provable RANDOM number between 0.00 and 99.99

function provability($serverseed)
    $clientseed = "94c6c5f4f8a26f56031eb973370af3c4"; //keep static, it's better to use 32 char sha1 string. to create a new one: "echo rand_sha1(32); function rand_sha1($length) {$max    = ceil($length / 40);$random = '';for ($i = 0; $i < $max; $i++) {$random .= sha1(microtime(true) . mt_rand(10000, 90000));}return substr($random, 0, $length);}"

    $c      = $clientseed;
    $result = strtoupper(hash_hmac('sha512', $c, $serverseed));

    $tmp2      = 0;
    $resultnum = 0;
    $flag      = 0;
    do {
        $hexnum    = substr($result, (5 * $tmp2), 5);
        $resultnum = hexdec($hexnum);

        if ($tmp2 * 5 + 5 > 128) {
            $flag = 1;
    } while ($resultnum >= 1000000 && $flag == 0);
    if ($flag == 1) {
        $lucky = 99.99;
    } else {
        $lucky = ($resultnum%10000)/100;
    return $lucky;

If you create a loop from 1 to 10.000, you will see that the output of our provability code will be distributed between 0.00 and 99.99 nearly equally.

It is up to you how you can use this function. For example, if you have big MySQL tables, you can easily make partitions with a unique key in the rows.

Let think you have a table which has 100M users with only phone number column.

When inserting these users, just call provability function with their phone number and insert the user to table “users_(INTVAL(RETURNED_NUMBER))”

By doing this, you can distribute your 100M users to 100 table with 1M rows. So basically, if you want to search a phone number in your database, just call provability function with the phone number and search the number in that table only.

Your inserting+searching operations will be decreased by x100 times automatically.