in tool/seedrandom.js [100:122]
function (prng, seed, is_math_call, state) {
if (state) {
// Load the arc4 state from the given state if it has an S array.
if (state.S) {
copy(state, arc4);
}
// Only provide the .state method if requested via options.state.
prng.state = function () {
return copy(arc4, {});
};
}
// If called as a method of Math (Math.seedrandom()), mutate
// Math.random because that is how seedrandom.js has worked since v1.0.
if (is_math_call) {
math[rngname] = prng;
return seed;
}
// Otherwise, it is a newer calling convention, so return the
// prng directly.
else return prng;
}