[php-src] Issue #10412: Problem in Random\Randomizer::pickArrayKeys
| From: | ulrichkapp | Date: | Sun, 22 Jan 2023 14:11:29 +0000 |
| Subject: | [php-src] Issue #10412: Problem in Random\Randomizer::pickArrayKeys | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243533@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10412
Author: ulrichkapp
### Description
The following code:
```php
<?php
$r = new \Random\Randomizer();
$a = range (1, 49);
$numbers = $r->pickArrayKeys($a, 7));
print_r($numbers);
?>
```
Resulted in this output:
```
Array
(
[0] => 0
[1] => 2
[2] => 9
[3] => 13
[4] => 28
[5] => 30
[6] => 48
)
```
But I expected this output instead:
```
The Code should never give back a 0 (zero), but sometimes does!
```
### PHP Version
8.2.1
### Operating System
macOS 13.1 (22C65)