"Do While" exercise - random number generator always gives zero

I’m doing Lab Exercise Manual activity 5.3 Do While. It’s a guessing number game where it should generate a random number under 25, and it will tell you to try a higher or a lower number until you get it correctly.
It works flawlessly, no bugs, except the “random number” I always get is 0 zero. I have a variable RandomNo, int32, main sequence (I’ve tried different options), and in default put 25. Which should be what generates the number I believe.
Anyone had this or a similar problem? I can’t find anywhere in the manual where I could be wrong on this.
Thanks in advance :slight_smile:

@steinunne22,

Make sure you are using logic like this

IntRandomNumber =New Random().Next(0,25)

Thanks,
Ashok :slightly_smiling_face:

This worked thank you. :slight_smile:

If anyone doing the assignment sees this I also had to erase a number I put into the variables as a part of the steps of the manual.

@steinunne22,

Glad to hear that. Kindly close the thread by marking my answer as solution so it will be helpful to other community members as well.

Thanks,
Ashok :slightly_smiling_face:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.