Skip to content

Instantly share code, notes, and snippets.

@edysegura
Last active August 29, 2015 14:20
Show Gist options
  • Save edysegura/fa210049c5895bcebb28 to your computer and use it in GitHub Desktop.
Save edysegura/fa210049c5895bcebb28 to your computer and use it in GitHub Desktop.
[JS] Unique ID with JS - source http://jsbin.com/telokagigo/3/edit?js,console
function random(seed) {
if (!seed)
seed = new Date().getTime();
seed = (seed*9301+49297) % 233280;
return seed/(233280.0) * 100;
}
function seed() {
var seedNumber = (Math.random() * Math.pow(10, 17) + Math.random() * Math.pow(10, 17) + Math.random() * Math.pow(10, 17) + Math.random() * Math.pow(10, 17));
return seedNumber;
}
for(var i=0; i<100; i++){
console.log(random(seed()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment