This is a very simple function, but it gets run on a roughly 10ms interval, so I'm looking for ways to improve it. The first obvious thing is that it has to run the comparisons nearly every time as it starts with the lowest probabilities first. Is there a way I can reverse that without breaking it, or a way I can generally improve the performance of this function to achieve the same end result?
function find_coin() {
var roll = Math.random() * 100;
if (roll < 0.01)
currency['platinum']++;
else if (roll < 0.1)
currency['gold']++;
else if (roll < 1)
currency['silver']++;
else if (roll < 10)
currency['bronze']++;
};