Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
random but uniform
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = 1; i <=12; i++) {
map.put(i, 0);
}
for (int i = 1; i <= 133; i++) {
int floor = (int) (1 + Math.random()*12);
map.put(floor, map.get(floor).intValue()+1);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question