|
Post by dottygame on Dec 25, 2020 5:24:19 GMT -6
When I use Rand(1000) in line 3, it keep returning 1, why? and when I replace it with Randomize(1000) function, it return 0, I dont understand 'Guess number game dim guess randnum=rand(1000) do print"Guess number from 0 to 1000:\n" guess=val(input("")) if guess<randnum then print "Your number is smaller than the answer! Guess again:\n" elseif guess>randnum then print "Your number is greater than the answer! Guess again:\n" end if loop while(guess<>randnum) print "YOU R CORRECT! The answer is: ";randnum print "Enter any key to quit" exitb$=input("") end
|
|
|
Post by n00b on Dec 25, 2020 6:23:38 GMT -6
You need to seed the random number generator. Add Randomize(Timer) to the top of your program to seed the random generator based on the number of milliseconds since the start of your program.
|
|
|
Post by dottygame on Dec 25, 2020 8:12:25 GMT -6
Thank you! It worked!
|
|