RosettaCodeData/Task/Random-number-generator-dev.../FutureBasic/random-number-generator-dev...

20 lines
622 B
Plaintext

include "Tlbx GameplayKit.incl"
local fn RandomBigInteger( digits as UInt64 ) as UInt64
end fn = fn GKLinearCongruentialRandomSourceSeed( fn GKLinearCongruentialRandomSourceInit ) mod digits
local fn RandomIntegerInRange( min as UInt64, max as UInt64 ) as UInt64
UInt64 rndIntInRange = fn RandomBigInt( max - min + 1 ) + min - 1
end fn = rndIntInRange
local fn ArcRandomIntegerInRage( min as long, max as long ) as long
long i
cln i = (arc4random()%(max-min+1))+min;
end fn = fn floor(i)
// Returns double in range of 0.0 to 50.0
double r
cln r = (((double)arc4random()/0x100000000)*50);
randomInteger = rnd(expr%)