RANDOM returns a random value for the provided datatype
MATH
RANDOM value
value - can be of types BYTE! (like up to 255) or INTEGER! type
/PSEUDO - will give you a deterministic sequence for which RANDOM/SEED will work
/SECURE - gives a true random value for which RANDOM/SEED is not needed
/SEED - randomizes the function
RANDOM returns a random value for the provided datatype
The next example returns a random BYTE! value
RANDOM/SEED NOW ; Uses current time to randomize data
value: RANDOM 100
Note that it does not limit the returned value to the given value, but it returns a random BYTE! value so 1 up to 255. Not all these functionalities are available on all platforms, so RANDOM gives you a platform default, usually RANDOM/PSEUDO .
Example RANDOM/PSEUDO
repeat 80 [
h: random/pseudo 255
write h write " "
]
write/line ""
repeat 80 [
h: random/pseudo 255
write h write " "
]
This returns different data on the two lines, but when you run again, the generated numbers are the same as last time.
RANDOM/SECURE is currently only implemented for Unix platforms
To be done. No other related method names assigned yet.