January 2006
Beginner
592 pages
16h 55m
English
random number
generate random number
Generates a random number. By default, this is a real between 0 and 1, but you can specify a different upper bound or both bounds. If every number you specify is an integer, the result is an integer, which could be either of the bounds; otherwise it is a real. You can seed the generator to get it started; this is useful for generating a fixed pseudo-random sequence.
random number
set L to {}
repeat 10 times
if (random number 1) as boolean then
set end of L to "heads"
else
set end of L to "tails"
end if
end repeat
L -- {"heads", "tails", "heads", "heads", "heads",
"tails", "heads", "heads", "heads", "heads"}Read now
Unlock full access