Those are some of the most weirdly complicated ways of doing this I've seen.
PHP Code:
function pickRandomNumber() {
if (random(0, 1) < 0.5) {
return 5;
} else {
return 10;
}
}
Usually the simplest solution is best. Code readability > tricky math. It's a lot easier to look at mine and see what it does than it is to stop and mentally parse out
int(random(1,2.9))*5.