server/utils/math.ts
2024-11-02 00:43:33 +01:00

8 lines
193 B
TypeScript

export const randomString = (
length: number,
encoding?: BufferEncoding,
): string =>
Buffer.from(crypto.getRandomValues(new Uint8Array(length))).toString(
encoding,
);