Random Numbers in VB??
How would you go about generating random numbers in VB??
thanks
Online RPGs.. Almost like another life! Except for whenswitching back to real life, sometimes I forget there isn'ta profanity filter..
I believe it is
Randomize
'Following line returns number from 1-6
X = int((6 - 1 + 1) * Rnd + 1)
Rnd returns a number from 0 to 1 I believe... Anyway it should work. goto msdn.microsoft.com if you need more help. Randomize shouldn't be called each time you get a random number i dont think....
E.D.
[EDIT]
Basically... the formula is
int((HighestValue - LowestValue + 1) * Rnd + LowestValue)
[EDIT]
Edited by - EnochDagor on November 17, 2000 4:38:14 PM
Randomize
'Following line returns number from 1-6
X = int((6 - 1 + 1) * Rnd + 1)
Rnd returns a number from 0 to 1 I believe... Anyway it should work. goto msdn.microsoft.com if you need more help. Randomize shouldn't be called each time you get a random number i dont think....
E.D.
[EDIT]
Basically... the formula is
int((HighestValue - LowestValue + 1) * Rnd + LowestValue)
[EDIT]
Edited by - EnochDagor on November 17, 2000 4:38:14 PM
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement