server/utils/math.ts

5 lines
174 B
TypeScript
Raw Normal View History

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