server/utils/math.ts

8 lines
193 B
TypeScript
Raw Normal View History

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