It can be simplified a bit more. You don´t need an if to return a bool.
bool PercentageChance(int percentage)
{
return Next(0, 101) <= percentage;
}
And yes, anyone who needs such a function can add it to their code.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Honeslty more of a statement then a question, don't you think you guys should do a random method for a percentage of chance to get a result and returns a bool accordingly? would be super easy, I could even code it for you.
bool PercentageChance(int percentage)
{
if(Next(0, 101) <= percentage)
return true;
return false;
}
you guys could even go as far as making a function for double also with NextDouble!
Don't you agree? I litteraly code this everytime in my projects.
It can be simplified a bit more. You don´t need an if to return a bool.
bool PercentageChance(int percentage)
{
return Next(0, 101) <= percentage;
}
And yes, anyone who needs such a function can add it to their code.