Skip to content

Instantly share code, notes, and snippets.

@anddam
Created September 17, 2019 15:02
Show Gist options
  • Save anddam/3a2a7fa152f832bd4b804d9a3488d7cf to your computer and use it in GitHub Desktop.
Save anddam/3a2a7fa152f832bd4b804d9a3488d7cf to your computer and use it in GitHub Desktop.
private makeName(length) {
const chars = this.chars;
let result: string;
range(1, length).pipe(
map(() => chars.charAt(Math.floor(Math.random() * chars.length))),
scan((acc, curr) => acc + curr, '')
).subscribe(name => result = name);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment