v Generate Random Numbers - Javascript

Generate Random Numbers

<script>

// Create a function that takes a max and min
function randomInteger(min, max) {
    // Returns the integer of a random number scaled by max and min, inclusively
    return Math.floor(Math.random() * (max - min + 1)) + min;
};

// Print to console
console.log('randomInteger:', randomInteger(0,100));

// Create a function that takes a max and min
function randomfloat(min, max) {
    // Returns the float of a random number scaled by max and min, exclusively
    return Math.random() * (max - min) + min;
};

// Print to console
console.log('randomfloat:', randomfloat(-1,1));


</script>