mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
34 lines
717 B
JavaScript
34 lines
717 B
JavaScript
'use strict';
|
|
|
|
function factory (type, config, load, typed) {
|
|
var rng = require('./rng');
|
|
|
|
/**
|
|
* Seed the random number generator
|
|
*
|
|
* Syntax:
|
|
*
|
|
* math.seedrandom('a') // seed random number generator with 'a'
|
|
*
|
|
* Examples:
|
|
*
|
|
* math.seedrandom('a')
|
|
* math.random(); // returns 0.43449421599986604 every time
|
|
*
|
|
* See also:
|
|
*
|
|
* random, randomInt, pickRandom
|
|
*
|
|
* @param {string} [seed] seed for random number generator
|
|
*/
|
|
// TODO: rework random to a typed-function
|
|
var seedrandom = rng.setSeed;
|
|
|
|
seedrandom.toTex = undefined; // use default template
|
|
|
|
return seedrandom;
|
|
}
|
|
|
|
exports.name = 'seedrandom';
|
|
exports.factory = factory;
|