Random numbers not so random

woknick

Registered User.
Local time
Yesterday, 19:52
Joined
Sep 25, 2004
Messages
85
im using this code to generate a random number. But everytime I close access and reopen the form the random number generated is always the same

Private Sub Form_Load()
Dim random As Double
Dim random2 As Double
random2 = Int((100 - 1 + 1) * Rnd + 1)
random = 0.1
random = Int((30 - 1 + 1) * Rnd + 1)
random = random * random2

The numbers i get from this are always
1207
522
744
46
1804
65

But once I close out access and restart it. the form produces the same numbers above.. Does anyone know what is going on...

Thanks in advance

Nick
 
You are not randomizing... look in the help file...

Dim MyValue
Randomize ' Initialize random-number generator.

MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.
 

Users who are viewing this thread

Back
Top Bottom