Created
November 12, 2018 20:38
-
-
Save balloonio/e1da3c4b095fac6d4bdc9a93a12b2abe to your computer and use it in GitHub Desktop.
Weighted random cache testing code
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
wr = WeightRandom() | |
wr.setObjectWeight(1, 1) | |
wr.setObjectWeight(2, 1) | |
wr.setObjectWeight(2, 0) | |
wr.setObjectWeight(3, 2) | |
for i in range(10): | |
print(wr.getRandom()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment