What about using Random
for all three factors? Random
can be used to find an operator from a list or array too for example.
You could use something like this (where operators
is an array of string
objects):
string[] operators = new string[] { "+", "-", "*" };
string oper = operators[randonNum.Next(operators.Length)];
Take a look at this working example:
// this list will contain the results
List<string> list = new List<string>();
// create an array of allowed operators
string[] operators = new string[] { "+", "-", "*" };
Random randonNum = new Random();
for (int i = 0; i < 200; i++)
{
// pick two numbers
int num1 = randonNum.Next(0, 500);
int num2 = randonNum.Next(0, 500);
// pick an operator from the array
string oper = operators[randonNum.Next(operators.Length)];
// add it to the list
list.Add(string.Format("{0}{1}{2}", num1, oper, num2));
}