How to generate random numbers in Python

Random integer up to Max

import random

def generate_random_integer(max: int) -> int:
    return random.randint(0, max - 1)

Random integer between Min and Max

import random

def generate_random_number(min: int, max: int) -> int:
    return random.randint(min, max)

Random float up to Max

import random

def generate_random_float(max: float) -> float:
    return random.uniform(0, max)

Random float between 0 and 1

import random

# random float between 0 and 1
random_float = random.random()