Index ButtonsFields Message Variables
Ask/Answer Graphics Sound Menus QuickTime

Random Numbers Project

Random is a very useful SuperCard function. One use is to be able to set up maths problems that are never the same twice

Make a new project.

The project can be small as above. Create a button and name it Random. Create a small rectangular field. You could set the text file in the field to a larger font size, say 16, and maybe a different font. Copy this field and paste it 5 times so you have 6 fields side by side.


Notice the fields are numbered in the order of creation

Paste the following script into your "Random" button:


This script will generate 6 unique random numbers each time you click the "Random" button.

You could make more fields for more random numbers and change the "sixes" in the script to the new number. Or you could change the 49 so that number you choose to select the random numbers from is greater ot smaller. Experiment with the script so you understand how it works. The Commas are used to separate (or delimit) the items. randNum, uniqueNum, selNum, theNum and thisOne are variables.

To clear the random numbers when you close the card put the following script in your card script

Return to top of page