12345678910111213141516171819202122232425 |
- '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
- };
|