<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="random-randomizer.shufflearray" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>Random\Randomizer::shuffleArray</refname>
  <refpurpose>Get a permutation of an array</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="Random\\Randomizer">
   <modifier>public</modifier> <type>array</type><methodname>Random\Randomizer::shuffleArray</methodname>
   <methodparam><type>array</type><parameter>array</parameter></methodparam>
  </methodsynopsis>
  <para>
   Returns a uniformly selected permutation of the input <parameter>array</parameter>.
  </para>

  <para>
   Each possible permutation of the input <parameter>array</parameter> is equally likely to be returned.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>array</parameter></term>
    <listitem>
     <para>
      The &array; whose values are shuffled.
     </para>
     <para>
      The input &array; will not be modified.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   A permutation of the values of <parameter>array</parameter>.
  </para>
  <para>
   Array keys of the input <parameter>array</parameter> will not be preserved;
   the returned &array; will be a list (<function>array_is_list</function>).
  </para>
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <itemizedlist>
   &random.engineErrors;
  </itemizedlist>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <title><function>Random\Randomizer::shuffleArray</function> example</title>
   <programlisting role="php">
<![CDATA[
<?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";
?>
]]>
   </programlisting>
   &example.outputs.similar;
   <screen>
<![CDATA[
Salad: 🍎, 🥝, 🍇, 🍌, 🍑
Another Salad: 🍑, 🍇, 🥝, 🍎, 🍌
]]>
   </screen>
  </example>
 </refsect1>


</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
