Skip to content

Instantly share code, notes, and snippets.

@kaievns
Created September 30, 2014 00:59
Show Gist options
  • Save kaievns/2fb484feb3e55c1ac439 to your computer and use it in GitHub Desktop.
Save kaievns/2fb484feb3e55c1ac439 to your computer and use it in GitHub Desktop.
Random hex of arbitrary size in javascript
function random_hex(size) {
return Array.apply(null, Array(size)).map(function() {
return (Math.random()*16|0).toString(16);
}).join("");
}
console.log(random_hex(128));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment