I have a function where in I allow my clients to generate random numbers on my site.

**Here is the PHP function**

```
function UniqueRandomNumbers($min, $max, $quantity)
{
    $numbers = range($min, $max);
    shuffle($numbers);
    return array_slice($numbers, 0, $quantity);
}

```

I am allowing the maximum `quantity` of `10000 numbers` when they submit a form using `From` and `To` inputs. 

I would like to validate if a user submits the range more than 10000 numbers then validation should throw an error. For example, if a client uses 10000 in `From input` and 30000 in `To input` then it should throw an error rather than processing the request. 

I tried with several stuff, but was not lucky enough to get through. 

How could I validate the max range of 10000 numbers?

Thanks in advance.