How can the code for the Zufallsgenerator be more efficient and concise for future customization by users?

To make the Zufallsgenerator code more efficient and concise for future customization by users, we can create a function that encapsulates the random number generation logic. This way, users can easily call the function with parameters to customize the range and quantity of random numbers generated.

function generateRandomNumbers($min, $max, $quantity) {
    $randomNumbers = [];
    
    for ($i = 0; $i < $quantity; $i++) {
        $randomNumbers[] = mt_rand($min, $max);
    }
    
    return $randomNumbers;
}

// Example usage
$min = 1;
$max = 100;
$quantity = 5;

$randomNumbers = generateRandomNumbers($min, $max, $quantity);
print_r($randomNumbers);