[swift-evolution] [Proposal] Random Unification
Erica Sadun
erica at ericasadun.com
Sat Dec 2 08:56:51 CST 2017
On Dec 1, 2017, at 11:23 PM, David Waite <david at alkaline-solutions.com> wrote:
>
>
>
>> On Dec 1, 2017, at 11:05 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> I'd like to put forth that Gameplay Kit offers a perfectly cromulent model of random number generation and API. Why not take that as a starting point, Swiftify it so it becomes a cross platform solution, and then apply the specific questions of sequences, collections, and indices as a second step?
>>
>> I don't support intermingling random functionality with existing core types.
>>
>
> GameplayKit randomization has a number of API deficiencies that we can’t easily/efficiently solve by wrapping it in Swift.
>
> Most significantly, it is not designed to support any cryptographic operations (which I believe is why they never added a nextBytes() or equivalent method).
>
> For GameplayKit this is fine - the design focuses on being able to get the distribution appropriate for your game, and being able to have identical pseudorandom number sequences for each device in a multiplayer scenario. They went as far as to require all random sources to support NSSecureCoding so that they may be persisted and/or serialized over the wire, which precludes a GKRandomSource from being based on the system random sources.
>
> -DW
I wasn't suggesting wrapping as that would not provide a cross platform solution. Instead of re-inventing the wheel, we may profit from the approaches already explored and real-world tested in prior art and existing standards.
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171202/095be5de/attachment.html>
More information about the swift-evolution
mailing list