public function getArray(array $array, $count)
    {
        $count = (int) $count;
        $size = count($array);

        if ($this->isOutOfBounds($count, 0, $size)) {
            throw new \InvalidArgumentException('Invalid number of elements');
        }

        $result = [];
        $keys = array_keys($array);

        for ($i = 0; $i < $count; $i++) {
            $index = $this->generator->getNumber($i, $size - 1);
            $result[$keys[$index]] = $array[$keys[$index]];
            $keys[$index] = $keys[$i];
        }

        return $result;
    }