Created
February 11, 2015 18:01
-
-
Save commuterjoy/b2c74486d484b3c40213 to your computer and use it in GitHub Desktop.
seedrandom
This file contains hidden or 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
// Usage - node distribution.js | sort | uniq -c | |
var seedrandom = require('./seedrandom'); | |
// Given a uniform set of even numbers, from 1 to 100k | |
var n = []; | |
for(var i=0; i<100000; i++) { if (i % 2 === 0) n.push(i); } | |
// Produce a set of evenly distributed set of seeded random numbers | |
n.forEach(function (m) { | |
Math.seedrandom(m); | |
console.log(parseInt(Math.random()*100)); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment