Difference between revisions of "API:RNG"
From Spherical
Bruce Pascoe (talk | contribs) m (→Description) |
Bruce Pascoe (talk | contribs) |
||
Line 33: | Line 33: | ||
* [[API:RNG::next|RNG::next()]] | * [[API:RNG::next|RNG::next()]] | ||
</tt> | </tt> | ||
+ | |||
+ | [[Category:Sphere 2 API]] |
Revision as of 06:12, 8 August 2017
Constructs a new instance of the pseudorandom number generator.
Usage
rng_obj = new RNG();
Description
The RNG constructor initializes a new instance of the Sphere random number generator, seeded based on the current time and date. Unlike Math.random() which uses a very basic linear generator, Sphere uses the xoroshiro128+ algorithm, providing games with a very high-quality source of pseudorandom numbers.
To control the initial state of the generator, use RNG.fromSeed() or RNG.fromState().
Properties
Methods
Static Methods
Instance Methods