Re: Random and MethodNext
Re: Random and MethodNext
Quote:
Originally Posted by electro53
I am new to coding and I some advice with coding a math equation (multiplaction)using RandomObject.Next ...
There's no question here... could you be more specific?
Re: Random and MethodNext
Hi,
Don't know what you are doing, but for the part you want to generate 20 random numbers between 1 and 15
try this
Code:
For j As Integer = 1 To 20
Console.Write(randomObject.Next(1,15+1))
' Public Overridable Function [Next](ByVal minValue As Integer, ByVal maxValue As Integer) As Integer
' returns greater than or equal to minValue and less than maxValue
' the range of return values includes MinValue but not MaxValue.
' that's why (15+1), NOT 15
Next
Re: Random and MethodNext
Seems easier to do in VB6. Build a form with a listbox to hold the numbers:
Code:
Private Sub Form_Load()
Randomize
For I = 1 To 20
List1.AddItem Str$(Int(Rnd * 15) + 1)
Next
End Sub
Re: Random and MethodNext
20 random numbers between 1 and 15 would generate some dups.