The application is then supposed to display the random number, sum up all random numbers generated, display the largest and smallest number generated, and find the average of all the numbers generated. I'm having trouble figuring out how to display the largest and smallest number generated in a random number generator. Everything i've tried either displays the random number generated or it +1. This is what I have so far

Private Sub genrn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles genrn.Click Try X = Integer.Parse(num1.Text) y = Integer.Parse(num2.Text) randomnumb = GenerateRandom.next(X, y + 1) Catch MessageBox.Show("Please enter in the smallest number on the left and largest on the right. No decimals", "error") End Try total += randomnumb invisible += 1 average = total / invisible randomnum.Text = randomnumb.ToString totalnum.Text = total.ToString largenum.Text = large.ToString smallnum.Text = small.ToString avenum.Text = average.ToString End Sub

I'm also consulting friends for help but this looks like the best place to go right now.