-
As posted before on here i have been trying to make a random number generator similar to a dice roller.
I am using the code
minr = Text1.Text
maxr = Text2.Text
randno = minr + Fix(Rnd * (maxr - minr + 1))
Label3.Caption = randno
That way i am able to put in how high i want the number value to be and how low i want it. Unfortuantly with that code it will give you the same number each time you start up the program. I do not really understand the seed function and i would be very thankful if someone could post the code or advice to help me better understand it and use it in my project
Thanks!
-
Use this statement
Randomize
This statement uses the return value from the Timer function as the new seed value
Hope this helps
The Bao
-
Dreys, all you need is juz add one more line of code before you Rnd function.
Code:
minr = Text1.Text
maxr = Text2.Text
'Initialize the Random Number generator
Randomize Timer
randno = minr + Fix(Rnd * (maxr - minr + 1))
Label3.Caption = randno