[swift-evolution] [Proposal] Random Unification

Jeremy Pereira jeremy.j.pereira at googlemail.com
Thu Oct 12 08:13:30 CDT 2017

> On 11 Oct 2017, at 18:01, Kevin Nattinger <swift at nattinger.net> wrote:
> IMO, if we have the extensions on Int(eger)/Float(ingPoint)/Array (RandomAccessSequence?), they should just be for convenience and with a sane default RNG*, and users that need more should just use methods on the RNGs directly.
> *: I don't think the default necessarily needs to be a CSRNG; if there's a fast one, fine. Are we building a padded room for the least competent engineer or a tool for the average to good engineer to use efficiently?

I don’t disagree that there should be a *default* RNG. I’m just pointing out that there are advantages to being able to override the default, and Swift has language features that allow you to do so without impacting the simplicity of the default version. I do not understand why, if you are going to have 

    init(randomInRange: Countable{Closed}Range<Int>)

you would be against also having 

    init(randomInRange: Countable{Closed}Range<Int>, ing: RNG)

as well. It’s both convenient and flexible.

More information about the swift-evolution mailing list