(PHP 8 >= 8.2.0)
Random\Randomizer::shuffleArray — Get a permutation of an array
$array
): array
Returns a uniformly selected permutation of the input array
.
Each possible permutation of the input array
is equally likely to be returned.
array
The array whose values are shuffled.
The input array will not be modified.
A permutation of the values of array
.
Array keys of the input array
will not be preserved;
the returned array will be a list (array_is_list()).
Random\Randomizer::$engine
的
Random\Engine::generate() 方法抛出的任何 Throwable。
示例 #1 Random\Randomizer::shuffleArray() example
<?php
$r = new \Random\Randomizer();
$fruits = [ 'red' => '