1 export const DEFAULT_CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
3 export default function getRandomString(length: number, charset = DEFAULT_CHARSET) {
4 const values = crypto.getRandomValues(new Uint32Array(length));
7 for (let i = 0; i < length; i++) {
8 result += charset[values[i] % charset.length];