Math.floor(Math.random() * (max + 1)); code example Example: Math.floor( Math.random () * (max - min + 1)) + min) Math.floor( Math.random () * (max - min + 1)) + min)