goog.testing.PseudoRandom
Classgoog.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
=}
opt_install
{boolean
=}
.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
}
opt_scope
{Object
=}
.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.
void
}
.disposeInternal()
[protected]Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:
mypackage.MyClass = function() { goog.base(this); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { goog.base(this, 'disposeInternal'); // Dispose logic specific to MyClass. ... };
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.install()
Installs this PseudoRandom as the system number generator.
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.random()
number
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.seed(seed)
Seed the generator.
seed
{number
=}
.uninstall()
Uninstalls the PseudoRandom.