To randomly permute a vector in Stan, the simplest approach is the following.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode stan code-with-copy"><code class="sourceCode stan"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="kw">functions</span> {</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>  <span class="dt">array</span>[] <span class="dt">int</span> permutation_rng(<span class="dt">int</span> N) {</span>
<span id="cb3-3"><a 