Files
nuxt-demo/app/utils/index.ts
2025-11-30 19:49:01 +08:00

8 lines
231 B
TypeScript

export function randomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min
}
export function randomFrom<T>(array: T[]): T {
return array[Math.floor(Math.random() * array.length)]!
}