Another nice example baked into #PHP why having different return types for the same function is a really bad idea. It just results in way more effort to do things right everywhere this function is used.
@danrot I agree with the sentiment, but in this specific case, you can use `return (array) array_rand($array, limit)` without adding cyclomatic complexity.
@gmazzap Oh, I didn't know about that! Thank you! It would still be simpler if I wouldn't have to know 😅

@danrot This is fixed with the `Randomizer::pickArrayKeys()` function:

https://www.php.net/manual/en/random-randomizer.pickarraykeys.php

PHP: Random\Randomizer::pickArrayKeys - Manual

Select random array keys

@timwolla True, but I still stumble upon the other method as well... I am also wondering why there is no `pickArrayValues` as well, because that's what I would actually need in my current use case 😅
PHP: Random\Randomizer::pickArrayKeys - Manual

Select random array keys

@timwolla I know that there is a way to do this using the pickArrayKeys method. But since that seems to be common enough to include it in the documentation as an example, I think it would also make sense to provide a pickArrayValues method doing exactly that.