Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hayleyxyz/f547f9ab6fd6644775779bbf9df3fa39 to your computer and use it in GitHub Desktop.
Save hayleyxyz/f547f9ab6fd6644775779bbf9df3fa39 to your computer and use it in GitHub Desktop.
some other dumb random string generator i made.js
const rnd = (len) => {
const arr = new Uint8Array(len);
crypto.getRandomValues(arr)
let str = '';
for(i in arr) {
start = 33;
end = 126;
str += String.fromCharCode((arr[i] % (end - start)) + start)
}
return str;
};
console.log(rnd(256));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment