Random numbers in C#

前端 未结 6 635
我寻月下人不归
我寻月下人不归 2021-01-24 19:52

I get the error below when I try to run the application I am sure its something simple but I dont see it. What I am trying to do it when I click a button I have labeled Play. I

6条回答
  •  终归单人心
    2021-01-24 20:46

    First, you shouldn't be newing up a random number generator every time you want a new random number. You should set the generator as a static or member variable and refer to it for each new number.

    Second, you have to pass a min and a max to your RandomNumber method.

提交回复
热议问题