Random

Easy
9
68.4% Acceptance

Write a function random() that takes no arguments and returns a random integer between 0 and Number.MAX_SAFE_INTEGER.

Instructions

  • Should always return an integer between 0 and Number.MAX_SAFE_INTEGER.

Example test cases

const randomNum = random(); console.log(randomNum); // e.g. 1234567890

Hints

  • You can use the built-in Math.random() method to generate a random number between 0 and 1.
  • Find a way to transform this number into an integer.