Some kind of count function...trying to display the amount of numbers which are < .5.
I have the following code so that when somebody hits the button, 25 random numbers are displayed, all between 0 and 1. I also have another button and 2 labels, where I want when somebody presses the other button, under 1 label to be the amount of numbers less than .5, and on the other label the amount of numbers greater than .5. How can this be done?
Public Class RdmNumGen
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = Rnd()
Label2.Text = Rnd()
Label3.Text = Rnd()
Label4.Text = Rnd()
Label5.Text = Rnd()
Label6.Text = Rnd()
Label7.Text = Rnd()
Label8.Text = Rnd()
Label9.Text = Rnd()
Label10.Text = Rnd()
Label11.Text = Rnd()
Label12.Text = Rnd()
Label13.Text = Rnd()
Label14.Text = Rnd()
Label15.Text = Rnd()
Label16.Text = Rnd()
Label17.Text = Rnd()
Label18.Text = Rnd()
Label19.Text = Rnd()
Label20.Text = Rnd()
Label21.Text = Rnd()
Label22.Text = Rnd()
Label23.Text = Rnd()
Label24.Text = Rnd()
Label25.Text = Rnd()
End Sub
End Class
I have the following code so that when somebody hits the button, 25 random numbers are displayed, all between 0 and 1. I also have another button and 2 labels, where I want when somebody presses the other button, under 1 label to be the amount of numbers less than .5, and on the other label the amount of numbers greater than .5. How can this be done?
Public Class RdmNumGen
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = Rnd()
Label2.Text = Rnd()
Label3.Text = Rnd()
Label4.Text = Rnd()
Label5.Text = Rnd()
Label6.Text = Rnd()
Label7.Text = Rnd()
Label8.Text = Rnd()
Label9.Text = Rnd()
Label10.Text = Rnd()
Label11.Text = Rnd()
Label12.Text = Rnd()
Label13.Text = Rnd()
Label14.Text = Rnd()
Label15.Text = Rnd()
Label16.Text = Rnd()
Label17.Text = Rnd()
Label18.Text = Rnd()
Label19.Text = Rnd()
Label20.Text = Rnd()
Label21.Text = Rnd()
Label22.Text = Rnd()
Label23.Text = Rnd()
Label24.Text = Rnd()
Label25.Text = Rnd()
End Sub
End Class