<div dir="ltr">Here's a stripped down verison of my implementation of the Xoroshiro128+ PRNG:<div><a href="https://gist.github.com/anonymous/527602968812f853d6147aea8c66d660">https://gist.github.com/anonymous/527602968812f853d6147aea8c66d660</a></div><div><br></div><div>/Jens</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 22, 2017 at 11:21 PM, Jens Persson <span dir="ltr"><<a href="mailto:jens@bitcycle.com" target="_blank">jens@bitcycle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry for the premature send ...<div>Here is the site: <a href="http://xoroshiro.di.unimi.it" target="_blank">http://xoroshiro.di.unimi.it</a><br></div><div>There is also a section there about "generating uniform doubles in unit interval" which is worth reading.</div><div>And here's how to get uniform floating point values in the range [0, 1) from various (supposedly) random bit patterns:</div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(4,51,255)"><span style="font-variant-ligatures:no-common-ligatures">extension</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt64</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(52,149,175)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> shifts: </span><span style="font-variant-ligatures:no-common-ligatures">UInt64</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> = 63 - </span><span style="font-variant-ligatures:no-common-ligatures">UInt64</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(</span><span style="font-variant-ligatures:no-common-ligatures">Double</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures">significandBitCo<wbr>unt</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(v >> shifts) * (.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">ulpOfOne</span><span style="font-variant-ligatures:no-common-ligatures">/2)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt32</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(v) + 0.5) / (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt32</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">max</span><span style="font-variant-ligatures:no-common-ligatures">) + 1.0)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt16</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(v) + 0.5) / (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt16</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">max</span><span style="font-variant-ligatures:no-common-ligatures">) + 1.0)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt8</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(v) + 0.5) / (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Double</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt8</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">max</span><span style="font-variant-ligatures:no-common-ligatures">) + 1.0)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(4,51,255)"><span style="font-variant-ligatures:no-common-ligatures">extension</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt64</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(52,149,175)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> shifts: </span><span style="font-variant-ligatures:no-common-ligatures">UInt64</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> = 63 - </span><span style="font-variant-ligatures:no-common-ligatures">UInt64</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(</span><span style="font-variant-ligatures:no-common-ligatures">Float</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures">significandBitCou<wbr>nt</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(v >> shifts) * (.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">ulpOfOne</span><span style="font-variant-ligatures:no-common-ligatures">/2)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt32</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(52,149,175)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> shifts: </span><span style="font-variant-ligatures:no-common-ligatures">UInt32</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> = 31 - </span><span style="font-variant-ligatures:no-common-ligatures">UInt32</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(</span><span style="font-variant-ligatures:no-common-ligatures">Float</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures">significandBitCou<wbr>nt</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(v >> shifts) * (.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">ulpOfOne</span><span style="font-variant-ligatures:no-common-ligatures">/2)</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt16</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures"> a = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(v) + 0.5</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures"> b = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt16</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">max</span><span style="font-variant-ligatures:no-common-ligatures">) + 1.0</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = a / b</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">init</span><span style="font-variant-ligatures:no-common-ligatures">(unitRange v: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt8</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures"> a = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(v) + 0.5</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures"> b = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Float</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">UInt8</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">max</span><span style="font-variant-ligatures:no-common-ligatures">) + 1.0</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">self</span><span style="font-variant-ligatures:no-common-ligatures"> = a / b</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> }</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">You will get a very fast and good quality prng using xoroshiro, converting to unit range floating point and then back to uniform range int if you want to, much much faster than arc4random.</span></p><span class="HOEnZb"><font color="#888888"><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/Jens</span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 22, 2017 at 11:17 PM, Jens Persson <span dir="ltr"><<a href="mailto:jens@bitcycle.com" target="_blank">jens@bitcycle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Check out the generators (especially xoroshiro) on this site:</div><div class="m_-8876985151572480040HOEnZb"><div class="m_-8876985151572480040h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 22, 2017 at 6:54 PM, Saagar Jha via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">Saagar Jha</div>
</div>
<br><div><span><blockquote type="cite"><div>On May 22, 2017, at 08:44, Edward Connell via swift-users <<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>> wrote:</div><br class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986Apple-interchange-newline"><div><div dir="ltr">Any ideas when Foundation on Linux will support arc4random_uniform? This is kind of an important function.<div>There doesn't seem to be any decent substitute without requiring the installation of libbsd-dev, which turns out to be messy. Currently I am doing this, but glibc random with mod does not produce good quality numbers, due to modulo bias.</div></div></div></blockquote><div><br></div></span><div>Modulo bias is easy to deal with, though, if you force random to produce a range that is a multiple of the range that you’re trying to produce:</div><span><div><br></div><div>guard range > 0 else { return 0 }</div></span><div>var random: Int</div><div>repeat {</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986Apple-tab-span" style="white-space:pre-wrap">        </span>random = Int(random())</div><div>} while(random > LONG_MAX / range * range)</div><div>return random % range</div><br><blockquote type="cite"><div><span><div dir="ltr"><div><div><br></div><div>Has anyone come up with a better solution to get a true uniform distribution that isn't super messy?</div><div> <div><div>import Foundation</div><div><br></div><div>#if os(Linux)</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>import Glibc</div><div>#endif</div></div><div><br></div><div><br></div><div><div>public func random_uniform(range: Int) -> Int {</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>guard range > 0 else { return 0 }</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>#if os(Linux)</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> return Int(random()) % range</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>#else</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>return Int(arc4random_uniform(UInt32(<wbr>range)))</div><div><span class="m_-8876985151572480040m_2482228478634656447m_1244819390521955986gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>#endif</div><div>}</div></div><div><br></div></div><div><br></div><div>Thanks, Ed</div></div></div></span><span>
______________________________<wbr>_________________<br>swift-users mailing list<br><a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br></span></div></blockquote></div><br></div><br>______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>