|
Answer» I have to create a random number from 1-100 using vbscript and using inputbox, if SOMEONE type 9, then the program will create 9 random number from range 1-100. If i USE RANDOMIZE and Rnd, will it create the random number from 1-100? and then how to create 9 random numbers from range 1-100? thanks for HELPING me.You can use a for/next loop to control how many numbers are displayed.
Code: [Select]intLowNumber = 1 intHighNumber = 100
intNumsToList = InputBox("How Many Numbers Do You Want Listed?", "Random")
For i = 1 to intNumsToList Randomize intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber) Wscript.Echo intNumber Next
Save SCRIPT with a vbs extension and run from the command line as cscript scriptname.vbs
Good luck. thanks but Quote Wscript.Echo intNumber i don't understand this code, is this code means to write the random number? thanks. Quotei don't understand this code, is this code means to write the random number?
Yes. Did you run the code? If you need a different type of output, you need to be more specific.
it worked actually. thanks a lot!
|