_comuns/src/aleatorio.ts
2026-02-08 20:30:35 -03:00

6 lines
238 B
TypeScript
Executable file

const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
export const aleatorio = (tamanho?: number) =>
`eli-${Array.from({ length: tamanho || 8 })
.map(() => alfabeto[((999 * Math.random()) | 0) % alfabeto.length])
.join("")}`