Core.random

From GiderosMobile
Revision as of 11:05, 23 August 2018 by Hgy29 (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2017.9<br/> === Description === Generate and return a pseudo random number. The random number sequence is guaranteed to be consistent...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2017.9

Description

Generate and return a pseudo random number. The random number sequence is guaranteed to be consistent across

 devices for a given seed.
 If bounds aren't specified, the function will return a floating point number between 0 and 1.
 If one bound is specified, the function will return an integer number between 1 and that bound (inclusive).
 If both bounds are specified, the function will return an integer between bound1 and bound2. bound2 must be greater than bound1.
(), = Core.random(generatorbound1bound2,)

generator: (number) PRNG algorithm to use, use 0 for default engine (MT19937) optional
bound1: (number) First bound of the range returned number must be in optional
bound2: (number) Second bound of the range returned number must be in optional
Returns () random number