You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
'use strict';
|
|
|
|
// Found this seed-based random generator somewhere
|
|
// Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
|
|
|
|
var seed = 1;
|
|
|
|
/**
|
|
* return a random number based on a seed
|
|
* @param seed
|
|
* @returns {number}
|
|
*/
|
|
function getNextValue() {
|
|
seed = (seed * 9301 + 49297) % 233280;
|
|
return seed/(233280.0);
|
|
}
|
|
|
|
function setSeed(_seed_) {
|
|
seed = _seed_;
|
|
}
|
|
|
|
module.exports = {
|
|
nextValue: getNextValue,
|
|
seed: setSeed
|
|
};
|