Created
June 23, 2009 09:46
-
-
Save Arbow/134456 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
/** | |
* 根据概率产生相应奖品 | |
* | |
* @return 相应对应的号码 | |
*/ | |
@SuppressWarnings("unchecked") | |
public static int getAward() { | |
Map result = new LinkedHashMap(); | |
for (int i = 0; i < 500; i++) { | |
result.put("" + i, "" + 0); | |
} | |
for (int i = 500; i < 500 + 250; i++) { | |
result.put("" + i, "" + 1); | |
} | |
for (int i = 500 + 250; i < 500 + 250 + 128; i++) { | |
result.put("" + i, "" + 2); | |
} | |
for (int i = 500 + 250 + 128; i < 500 + 250 + 128 + 100; i++) { | |
result.put("" + i, "" + 3); | |
} | |
for (int i = 500 + 250 + 128 + 100; i < 500 + 250 + 128 + 100 + 20; i++) { | |
result.put("" + i, "" + 4); | |
} | |
for (int i = 500 + 250 + 128 + 100 + 20; i < 500 + 250 + 128 + 100 + 20 + 2; i++) { | |
result.put("" + i, "" + 5); | |
} | |
String reState = result.get("" + (int) (Math.random() * 1000)) + ""; | |
return Integer.parseInt(reState); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment