13 lines
293 B
TypeScript
13 lines
293 B
TypeScript
![]() |
/**
|
|||
|
* 生成0~10000的随机数
|
|||
|
*/
|
|||
|
export const generateId = (): number => Math.floor(Math.random() * 10000)
|
|||
|
|
|||
|
/**
|
|||
|
* 生成随机数(0 ~ max)
|
|||
|
* @param max 最大值
|
|||
|
* @returns 随机数
|
|||
|
*/
|
|||
|
export const getRandomInt = (max: number) =>
|
|||
|
Math.floor(Math.random() * Math.floor(max))
|