Random\Randomizer::shuffleArray

Get a permutation of an array

&reftitle.description; public `array` `Random\Randomizer::shuffleArray` `array` `array`

Returns a uniformly selected permutation of the input `array`.

Each possible permutation of the input `array` is equally likely to be returned.

&reftitle.parameters;

`array`

- The &array; whose values are shuffled.

  The input &array; will not be modified.

&reftitle.returnvalues;

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`).

&reftitle.errors;

&random.engineErrors;

&reftitle.examples;

### `Random\Randomizer::shuffleArray` example

    <?php
    $r = new \Random\Randomizer();

    $fruits = [ 'red' => '🍎', 'green' => '🥝', 'yellow' => '🍌', 'pink' => '🍑', 'purple' => '🍇' ];

    // Shuffle array:
    echo "Salad: ", implode(', ', $r->shuffleArray($fruits)), "\n";

    // Shuffle again:
    echo "Another Salad: ", implode(', ', $r->shuffleArray($fruits)), "\n";
    ?>

&example.outputs.similar;

    Salad: 🍎, 🥝, 🍇, 🍌, 🍑
    Another Salad: 🍑, 🍇, 🥝, 🍎, 🍌