所以我有生成随机例子的函数,但我需要这个函数也是随机的。提前谢谢;)
public void generateExample()
{
x = Random.Range(0, 10);
y = Random.Range(0, 10 - x);
_text.GetComponent<TextMesh>().text = x.ToString() + " + " + y.ToString() + " =";
resultNum = x + y;
}
public void generateExample2()
{
x = Random.Range(0, 10);
y = Random.Range(0, x);
_text.GetComponent<TextMesh>().text = x.ToString() + " - " + y.ToString() + " =";
resultNum = x - y;
}
答案 0 :(得分:0)
y = new Random();
x = y.Range(0, 1);
if (x == 0)
{
generateExample();
}
else if (x == 1)
{
generateExample2();
}