I’m just going to mention that there was a tiny discussion about Random in early March (only five messages, all linked to below).
That thread discussed the different expectations/understandings of “random”. Regards, David https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033473.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033473.html> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033474.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033474.html> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033477.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033477.html> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033478.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033478.html> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033482.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170227/033482.html> > On 3 Apr 2017, at 21:24, Pedro Ferreira via swift-evolution > <[email protected]> wrote: > > Thanks for the correction. > 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. > > On Mon, Apr 3, 2017 at 6:53 PM, Peter Dillinger <[email protected] > <mailto:[email protected]>> wrote: > > func getRandom(_ min: Int, _ max: Int) -> Int { > > > let diff = max - min + 1 > > > > > > #if os(Linux) > > > return min + Int(random() % diff) > > > ... > > > > Implementation detail: non-uniformity mistakes of the past should not be > repeated. http://stackoverflow.com/a/6852396/454544 > <http://stackoverflow.com/a/6852396/454544> (Timed out on finding a better > reference.) > > > > -- > > Peter Dillinger, Ph.D. > > Software Engineering Manager, Coverity Analysis, Software Integrity Group | > Synopsys > > www.synopsys.com/software <http://www.synopsys.com/software> > > > > > > > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
