Random

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.
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser