> On Oct 12, 2017, at 6:13 AM, Jeremy Pereira <[email protected]>
> wrote:
>
>
>
>> On 11 Oct 2017, at 18:01, Kevin Nattinger <[email protected]> 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.
My point is that the root method ("designated [not actually an] initializer")
should be `rngInstance.randomInt()`, so I don't see a reason to also have an
RNG argument on the convenience `Int.random()`.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution