|
Random numbers are very useful in programming. Especially games. For example, you may need to have the computer randomly pick a move in a board game. Anyway, random numbers are very fun to work with once you learn to use them.
Here is the syntax for a random integer between the numbers 1 and 100:
randInt(1,100)
Here is the syntax for a random real number:
randNorm(1,100)
Of course, once you generate the random number you must store it in a variable. You do this basically the same way you store a regular value in a variable. Here is how:
randInt(1,100) -> A
This code will store a random integer between 1 and 100 in the variable A. You can then work with the random number just like you would a regular variable.
|