Skip to content

Instantly share code, notes, and snippets.

@cneill
Last active September 3, 2015 02:37
Show Gist options
  • Save cneill/3d99d1c73de11e689d90 to your computer and use it in GitHub Desktop.
Save cneill/3d99d1c73de11e689d90 to your computer and use it in GitHub Desktop.
function get_random_bytes (len) {
return crypto.randomBytes(Math.ceil(len / 2))
.toString('hex')
.slice(0, len);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment