The most widely used method in JavaScript for generating random numbers is Math.random(). It gives back an unexpected floating-point result between 0 and 1, inclusive. You can modify the outcome in line with your needs to produce integers within a particular range.