This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isaac = require('isaac'); // https://github.com/rubycon/isaac.js | |
/** | |
* generate a random number using isaac RNG | |
* @param {String} seed - the seed for isaac RNG | |
* @returns {Number} Random number between 0.0 and 1.0 | |
*/ | |
function isaacRandom(seed) { | |
isaac.seed(seed); | |
return isaac.random(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Bluebird = require('bluebird'); | |
/** | |
* Create a `sha256` hash of the seed. | |
* @param {String} seed - Previous server `seed` | |
* @returns {String} `sha256` hash of the `seed` | |
*/ | |
function createHash(seed) { | |
return crypto.createHash('sha256').update(seed).digest('hex'); | |
} |