Home / Javascript Tips Generated By ChatGPT / Combining Math.random and Math.floor to Generate Random Integers in Javascript You can generate random integers within a range. Source Code function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } console.log(getRandomInt(10));