LoginLogin

Number Randomization

Root / Programming Questions / [.]

DeathElementCreated:
I just started coding with SmileBasic and I was thinking about starting with a simple "guess the number" game. The only problem is: I have no idea how to make a random number. can someone help, please?

Nice pic The command is:
RND(amount of numbers)
Examples: You want a random number between 0 and 3.
RANDOMNUMBER=RND(4)
You want a random number between 5 and 9.
RANDOMNUMBER=RND(5)+5

thanks mates :3

You can also use my Input and Conditional Logic tutorial and combine it with the random number function to ask the user to guess the random number. Then you can use my Loops tutorial to actually make the game.