[swift-evolution] [Proposal] Random Unification

Ross O'Brien narrativium+swift at gmail.com
Mon Sep 11 04:18:21 CDT 2017


When Apple added GameplayKit to iOS, they added randomisation functions.
Could that implementation be repeated in Swift Foundation?

On Mon, Sep 11, 2017 at 2:48 AM, Susan Cheng via swift-evolution <
swift-evolution at swift.org> wrote:

> Hello,
>
> I have an implementation for reference
> https://github.com/SusanDoggie/Doggie/blob/master/Sources/Doggie/
> Foundation/Random.swift
>
> It's easy to remind that what's the range of random floating point number
>
> Double.random(includeOne: true)
> Double.random(includeOne: false)
>
> 2017-09-09 0:52 GMT+08:00 Alejandro Alonso via swift-evolution
> <swift-evolution at swift.org>:
> > Hello swift evolution, I would like to propose a unified approach to
> > `random()` in Swift. I have a simple implementation here
> > https://gist.github.com/Azoy/5d294148c8b97d20b96ee64f434bb4f5. This
> > implementation is a simple wrapper over existing random functions so
> > existing code bases will not be affected. Also, this approach introduces
> a
> > new random feature for Linux users that give them access to upper
> bounds, as
> > well as a lower bound for both Glibc and Darwin users. This change would
> be
> > implemented within Foundation.
> >
> > I believe this simple change could have a very positive impact on new
> > developers learning Swift and experienced developers being able to write
> > single random declarations.
> >
> > I’d like to hear about your ideas on this proposal, or any implementation
> > changes if need be.
> >
> > - Alejando
> >
> >
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
> >
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170911/3db24479/attachment.html>


More information about the swift-evolution mailing list