hamda000
asked on
Random Numbers
I would like to generate multiple numbers between two values (Exemple: 2000 and 3000).
I wrote this program but it generate only one value at one click. I want to generate multiple integers in one click (2000, 2001, 2020, 2876...). Here is my code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim r As Random = New Random
MsgBox(r.Next(10, 15))
End Sub
End Class
Any idea please?
Thanks.
I wrote this program but it generate only one value at one click. I want to generate multiple integers in one click (2000, 2001, 2020, 2876...). Here is my code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim r As Random = New Random
MsgBox(r.Next(10, 15))
End Sub
End Class
Any idea please?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Now I have to work on the sorting.
Create a loop that runs "n" times according to how many random numbers you want.
Initialise a variable to store the result in and for each run through the loop, append a random number and, so long as n is less than the total of random numbers required, a comma and a space.
When the loop has finished, pass the variable back to the calling code.