How to generate random number in javascript

Random integer up to Max

function generateRandomInteger(max: number): number {
    return Math.floor(Math.random() * max);
}

Random integer between Min and Max

function generateRandomNumber(min: number, max: number): number {
    return Math.floor(Math.random() * (max - min + 1) + min);
}

Random float up to Max

function generateRandomFloat(max: number): number {
    return Math.random() * max;
}

Random float up to Max

// random float between 0 and 1
const randomFloat = Math.random();