Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Functions

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

random

the random of posInteger
Value returned: a random integer between 1 and posInteger

Random returns values for integers up to 2^31 - 2.


Demo Script

on hyperMath
   -- This is a very simple math flash card script.
   put random(50) into intOne
   put random(50) into intTwo
   put item random(2) of "+,-" into theOperator
   put intOne && theOperator && intTwo && "=" && ¬
   (the value of (intOne && theOperator && intTwo)) into theAnswer
   put 0 into theCount
   ask "What is" && intOne && theOperator && intTwo
   if it is empty then exit hyperMath
   if it is last word of theAnswer then put "That's right!" & ¬
   return before theAnswer
   answer theAnswer
 end hyperMath

Placeholders

posInteger
An expression that evaluates to a positive integer.

For example:
3
67 mod 13
the number of bg fields
the number of backgrounds
the number of cards div 2
See also: background, bkgnd, button, card, chunk, field, menu, and menuItem

Related Topics

« programs | HyperTalk Reference | result »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View