Last active
January 2, 2016 13:39
-
-
Save TerrorBite/8311290 to your computer and use it in GitHub Desktop.
Stuff for secret stuff
This file contains hidden or 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
enum rarities { | |
VERY_COMMON, | |
COMMON, | |
LESS_COMMON, | |
RARE, | |
VERY_RARE, | |
EXTRA_RARE | |
} | |
// 50, 25, 15, 7, 2, 1 | |
int val = Random.nextInt(100); | |
if(val<50) return VERY_COMMON; // 50 = 50 | |
else if(val<75) return COMMON; // 75 = 50+25 | |
else if(val<90) return LESS_COMMON; // 90 = 50+25+15 | |
else if(val<97) return RARE; // 97 = 50+25+15+7 | |
else if(val<99) return VERY_RARE; // 99 = 50+25+15+7+2 | |
else return EXTRA_RARE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment