Skip to content

Instantly share code, notes, and snippets.

@pwener
Last active February 3, 2021 21:31
Show Gist options
  • Select an option

  • Save pwener/bf52da31fdbe6aef5d98d11d7bff0b4f to your computer and use it in GitHub Desktop.

Select an option

Save pwener/bf52da31fdbe6aef5d98d11d7bff0b4f to your computer and use it in GitHub Desktop.
Random string with lenght n (Typescript/Javascript)
function randomString(range: number) {
let str = '';
for(let index=0; index <= range; index++) {
str += Math.random().toString(36).replace(/\./g,'');
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment