(length = 16)
| 36 | * @returns Random string composed of A-Z, a-z, 0-9 |
| 37 | */ |
| 38 | export function generateRandomString(length = 16): string { |
| 39 | const bytes = generateRandomBytes(length) |
| 40 | return Array.from(bytes) |
| 41 | .map((b) => CHARS[b % CHARS.length]) |
| 42 | .join('') |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Returns a cryptographically secure random float in [0, 1). |
no test coverage detected