|
-
Jun 7th, 2005, 03:26 PM
#1
Thread Starter
Lively Member
Random numbers [resolved]
Ok then, I need help with VB code to generate six random unique numbers in the range of 1 thru 49 inclusive. I have my array declared and have tried to use the combination of Randomize and Rnd functions, which is working except that it's, at times, generating duplicate numbers......
Last edited by SmagO; Jun 8th, 2005 at 03:43 AM.
Reason: resolved
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
-
Jun 7th, 2005, 03:28 PM
#2
Re: Random numbers
Try this:
VB Code:
Private Function MakeRandom(intLowest As Integer, intHighest As integer) As Long
Ramdomize
Din intTemp As Integer
If intLowest > intHighest Then
intTemp = intLowest
intLowest = intHighest
intHighest = intTemp
End If
MakeRandom = CLng((intHighest - intLowest + 1) * Rnd + intLowest)
End Function
Or, have a look here for some new functions that were develped for this job 
Cheers,
RyanJ
-
Jun 7th, 2005, 03:28 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|