-
-
Save onemouth/76f52718fd989c8bffe59a6acce758d8 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 = -1; | |
int j = 0; | |
while (j < num_buckets) { | |
b = j; | |
double r = random.next(); | |
j = floor((b + 1) / r); | |
} | |
return b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment