Skip to content

Instantly share code, notes, and snippets.

@James1x0
Last active January 11, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save James1x0/52b58b1024f0efb786ff to your computer and use it in GitHub Desktop.
Save James1x0/52b58b1024f0efb786ff to your computer and use it in GitHub Desktop.
Neat little random array generator I came up with for a thought experiment.
function runAlongFolks ( init, iter, deviation ) {
var n = init || 150,
arr = [];
for ( var i = 0; i < iter; i++ ) {
var a = Math.floor(Math.random() * (deviation - (-deviation) + 1)) - deviation;
arr.push(n);
n += a;
}
return arr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment