I have run into this issue before with VB6. RND seemingly follows the same ???? thing. it is not truly random.
I created a simple scrabble game for students at my school. but when I click the "new game" button the same letters come up every time. in the exact same order. clicking the "new game" button again does generate a different set of letters but for some reason the first time when the game is first started the exact same letters come up in the same order.
here are those 7 letters S N P H H U A.
Anyway to make it work like it should?
TIA
DougP
I created a simple scrabble game for students at my school. but when I click the "new game" button the same letters come up every time. in the exact same order. clicking the "new game" button again does generate a different set of letters but for some reason the first time when the game is first started the exact same letters come up in the same order.
here are those 7 letters S N P H H U A.
Code:
Dim RandomNumber As Integer
Dim MyLetter, LetterToLoad As String
For a = 1 To 7
RandomNumber = Int((26 * Rnd) + 1) 'generate a random number from 1 to 26 letters
MyLetter = Chr(RandomNumber + 64) 'returns the ASCII of a letter
' the letters are jgp images and right now are just worth 1 point , thus the name A1, B1, etc
LetterToLoad = App.Path & "\Letters\" & Trim(MyLetter) & "1.jpg"
' load the images in the appropraiate images box at the bottom
Me.imgNewLetters(a).Picture = LoadPicture(LetterToLoad)
Next
Anyway to make it work like it should?
TIA
DougP