pedHeads = Boolean.random(using: &amp;myGenerator)
if flippedHeads {
    print(&quot;Heads, you win!&quot;)
} else {
    print(&quot;Maybe another try?&quot;)
}</code></pre>

<p><strong><code>generator</code>:</strong>  The random number generator to use when creating
  the new random value.
<strong>Returns:</strong> Either <code>true</code> or <code>false</code>, randomly chosen with equal
  probability.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">static func random&lt;T&gt;(using ge