← Back to challenges

Random Integer Generator

JavaScriptHardnumberslogic

Instructions

The challenge is simple. Return a random integer N such that a <= N <= b.

Examples

randomInt(5, 9) ➞ 7

randomInt(5, 9) ➞ 9

randomInt(5, 9) ➞ 5

Notes

  • Return value must be an integer.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: A Simple Task