-
-
Save onemouth/7532884112aae7b1401802d6d753c87c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ch(int key, int num_buckets) { | |
random.seed(key); | |
int b = 0; | |
for (int j = 1; j < num_buckets; j++) { | |
if (random.next() < 1.0 / (j + 1)) | |
b = j; | |
} | |
return b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment