Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   Random (http://zelaron.com/forum/showthread.php?t=32303)

Arbitus 2004-08-11 04:09 AM

Random
 
Alright im just hoping someone here knows Visual Basic, anyways.
I know how to generate a random number 1-anything I want. But I forget how to create a random number anything-anything. I.E. 45-100

Int(Rnd * 10)

That is the code to generate a number 1-10. And no

Int(Rnd 45 * 100)

Doesnt work..

BlueCube 2004-08-11 05:35 AM

blah = int(rnd(1)*x)+y

Y is the minimum number, and X is the maximum number minus Y.

===

So, for 45-100, the code is:

blah = int(rnd(1)*55)+45

You're basically just generating a number from 0 to 55, and adding 45 to it... make sure to RANDOMIZE TIMER before it though..

Arbitus 2004-08-11 03:45 PM

Thanks dude.


All times are GMT -6. The time now is 07:58 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.