rand.ts 364 B

123456789101112
  1. /**
  2. * Generate random number in range [0, 1000]
  3. * Maybe replace with [uuid](https://www.npmjs.com/package/uuid)
  4. */
  5. export const generateId = (): number => Math.floor(Math.random() * 10000)
  6. /**
  7. * Generating a random int in range (0, max - 1)
  8. * @param max {number}
  9. */
  10. export const getRandomInt = (max: number) =>
  11. Math.floor(Math.random() * Math.floor(max))