What are the best practices for efficiently generating unique random numbers in PHP arrays?

When generating unique random numbers in PHP arrays, it is important to ensure that each number is unique to avoid duplicates. One efficient way to achieve this is by using the `array_rand` function in combination with `array_unique` to generate unique random numbers.

// Generate an array of unique random numbers
$min = 1;
$max = 100;
$quantity = 10;

$randomNumbers = array();
while(count($randomNumbers) < $quantity){
    $randomNumbers[] = mt_rand($min, $max);
    $randomNumbers = array_unique($randomNumbers);
}

print_r($randomNumbers);