Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created February 11, 2015 18:01
Show Gist options
  • Save commuterjoy/b2c74486d484b3c40213 to your computer and use it in GitHub Desktop.
Save commuterjoy/b2c74486d484b3c40213 to your computer and use it in GitHub Desktop.
seedrandom
// 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