For some reason, whenever i call the statement "random.nextInt(5)", it always returns 4. But only in two of the methods that i have, otherwise, it works correctly. The two methods that don't work are as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13
| public String getRandomDeathMessage(){ int c = random.nextInt(5); String ret = "dead"; switch(c){ case 0:ret = "You got dead."; case 1:ret = "You done died, son."; case 2:ret = "How's the dying going?"; case 3:ret = "I admit, you should've made that."; case 4:ret = "Nice one, slab."; } return ret; } |
The second method is essentially a clone of this one, only a different variable.
It always returns "Nice one, slab."
Does anyone know why, or what i could do to fix it?