AshKeys

Confessions and Confusions of Ashok M A. Personal and Professional Blog.

Ashok Mannolu Arunachalam, snippets
Back

Generate random number within a range

const min = 1;
const max = 10;
const random = Math.floor(Math.random() * (max - min +1 )) + min;
console.log(random);
// Random numbers from 1 - 10 (including both 1 and 10)