I have a simple implementation question. Here is the random number function I have, and returns a random number from a given range, inclusive.
function randomNum(low, high){
return Math.floor(Math.random() * (high - low + 1)) + low;
}
However, I would like to have 50% chance of getting the high number, and 25% for everything else..
for example:
randomNum(1, 3)
'3' would have a 50% chance of getting a hit, while '1' and '2' will both have a hit percentage of 25%. I'm not too sure as to what changes I need to make to my function...tips would be great, Thanks