| @@ 1520-1529 (lines=10) @@ | ||
| 1517 | * |
|
| 1518 | * @throws \RangeException If array is empty |
|
| 1519 | */ |
|
| 1520 | public function randomKey() |
|
| 1521 | { |
|
| 1522 | $result = $this->randomKeys(1); |
|
| 1523 | ||
| 1524 | if (!isset($result[0])) { |
|
| 1525 | $result[0] = null; |
|
| 1526 | } |
|
| 1527 | ||
| 1528 | return $result[0]; |
|
| 1529 | } |
|
| 1530 | ||
| 1531 | /** |
|
| 1532 | * Pick a given number of random keys/indexes out of this array. |
|
| @@ 1565-1574 (lines=10) @@ | ||
| 1562 | * |
|
| 1563 | * @return mixed get a random value or null if there wasn't a value |
|
| 1564 | */ |
|
| 1565 | public function randomValue() |
|
| 1566 | { |
|
| 1567 | $result = $this->random(1); |
|
| 1568 | ||
| 1569 | if (!isset($result[0])) { |
|
| 1570 | $result[0] = null; |
|
| 1571 | } |
|
| 1572 | ||
| 1573 | return $result[0]; |
|
| 1574 | } |
|
| 1575 | ||
| 1576 | /** |
|
| 1577 | * Pick a given number of random values out of this array. |
|