API:RNG

From Spherical
Revision as of 04:08, 12 August 2017 by Bruce Pascoe (talk | contribs) (Add some subheadings)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The RNG() constructor initializes a new instance of the pseudorandom number generator, seeded using the current time and date.

Usage
rng_object = new RNG();

API Information

Description

new RNG() initializes a new instance of the built-in pseudorandom 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