src/Primitive/Container/Container.php
public function randomKey($quantity = 1)
    {
        $quantity = $this->getIntegerable($quantity);

        if ($this->isNotEmpty() && $this->length() >= $quantity && $quantity > 0)
        {
            $random = array_rand($this->items, $quantity);

            return is_array($random) ? new static($random) : $random;
        }

        throw new BadMethodCallException("1 Argument should be between 1 and the number of elements in the Container, got: {$quantity}");
    }
public function randomKey($quantity = 1)
    {
        $quantity = $this->getIntegerable($quantity);

        if ($this->isNotEmpty() && $this->length() >= $quantity && $quantity > 0)
        {
            $random = array_rand($this->items, $quantity);

            return is_array($random) ? new static($random) : $random;
        }

        throw new BadMethodCallException("1 Argument should be between 1 and the number of elements in the Container, got: {$quantity}");
    }
Return pseudo-random index from Container.

@param int|IntegerContract $quantity
@throws BadMethodCallException
@return mixed