I am looking at having a option to specify how often something should run, in terms of a percentage.
So I would have a textbox, that takes a number 0-100 to detirmine a percentage. I want to then take this number, and convert in into a matching random statement.
So for example:
textPercentage.text = "10"
would be changed to something like:
if (rnd.Next(1, 11) = 1)
{
do();
}
What is the best way to convert that numerical value to a matching random statement?
You might want to use
int.TryParsein stead ofint.Parseto gracefully handle non digit inputs.