Add a bias to random()
in
Programming Questions
•
8 months ago
Hey, just have a quick question. I want to make a random variable that favours a certain number. So, for example:
int x = int(random(10);
So it'll choose a number from zero to nine. Now, on that, I want to add that it will have a 50% higher chance of choosing numbers zero through four. How would I go about doing that, if it's possible?
Thanks!
int x = int(random(10);
So it'll choose a number from zero to nine. Now, on that, I want to add that it will have a 50% higher chance of choosing numbers zero through four. How would I go about doing that, if it's possible?
Thanks!
1