public static function getRandomElementsFromArray(array $values, int $count = 0) :array {

        $valuesLength = count($values);
        if ($count > $valuesLength)
        {
            throw new \InvalidArgumentException('Count larger than array length.');
        }

        if (!$count)
        {
            $count = random_int(0, $valuesLength);
        }

        if ($count === 0)
        {
            return [];
        }

        return array_intersect_key(
            $values,
            array_flip(
                (array) array_rand($values, $count)
            )
        );
    }