The goog.testing.PseudoRandom Class

goog.testing.PseudoRandom
> goog.Disposable

goog.testing.PseudoRandom(opt_seed, opt_install)

Class for unit testing code that uses Math.random. Generates deterministic random numbers.

opt_seed {number=}
The seed to use.
opt_install {boolean=}
Whether to install the PseudoRandom at construction time.

.A {number}

Constant used as part of the algorithm.

.M {number}

Constant used as part of the algorithm. 2^31 - 1.

.ONE_OVER_M_MINUS_ONE {number}

Constant used as part of the algorithm to get values from range [0, 1).

.Q {number}

Constant used as part of the algorithm. It is equal to M / A.

.R {number}

Constant used as part of the algorithm. It is equal to M % A.

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.install()

Installs this PseudoRandom as the system number generator.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.random()

returns {number}
The next number in the sequence.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.seed(seed)

Seed the generator.

seed {number=}
The seed to use.

.uninstall()

Uninstalls the PseudoRandom.