I have this:
int minValue = int.Parse(min.Text);
int maxValue = int.Parse(max.Text);
Random rnd = new Random();
int final = rnd.Next(minValue, maxValue);
result.Text = final.ToString("");
I'm going to get the two values (lower value and higher value) to two textboxes. These values are entered by the user. When I generate the random number, in no situation does the higher value appear. For example, the user enters 1 and 5. I repeatedly generate a number and in no situation does the number 5 appear. It only appears either 1, or 2, or 3, or 4, not 5. Why?
Aucun commentaire:
Enregistrer un commentaire