<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I’m just going to mention that there was a tiny discussion about Random in early March (only five messages, all linked to below).</div><div class=""><br class=""></div><div class="">That thread discussed the different expectations/understandings of “random”. </div><div class=""><br class=""></div><div class="">Regards,</div><div class="">David</div><div class=""><br class=""></div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033473.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033473.html</a></div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033474.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033474.html</a></div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033477.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033477.html</a></div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033478.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033478.html</a></div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033482.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033482.html</a></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 3 Apr 2017, at 21:24, Pedro Ferreira via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Thanks for the correction. <div class="">I guess that helps my point, its easy to get this sort of thing wrong, so it would be a good candidate for being included in the standard library.<br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Apr 3, 2017 at 6:53 PM, Peter Dillinger <span dir="ltr" class=""><<a href="mailto:Peter.Dillinger@synopsys.com" target="_blank" class="">Peter.Dillinger@synopsys.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple" class="">
<div class="m_-6315270966743277810WordSection1"><span class=""><p class="m_-6315270966743277810MsoPlainText">> func getRandom(_ min: Int, _ max: Int) -> Int {<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">> let diff = max - min + 1<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">> <u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">> #if os(Linux)<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">> return min + Int(random() % diff)<u class=""></u><u class=""></u></p>
</span><p class="m_-6315270966743277810MsoPlainText">> ...<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"><u class=""></u> <u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">Implementation detail: non-uniformity mistakes of the past should not be repeated.
<a href="http://stackoverflow.com/a/6852396/454544" target="_blank" class="">http://stackoverflow.com/a/<wbr class="">6852396/454544</a> (Timed out on finding a better reference.)<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"><u class=""></u> <u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">-- <u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">Peter Dillinger, Ph.D.<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText">Software Engineering Manager, Coverity Analysis, Software Integrity Group | Synopsys<u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"><a href="http://www.synopsys.com/software" target="_blank" class="">www.synopsys.com/software</a><u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"><u class=""></u> <u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"> <u class=""></u><u class=""></u></p><p class="m_-6315270966743277810MsoPlainText"><u class=""></u> <u class=""></u></p>
</div>
</div>
</blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>