[swift-evolution] [Proposal] Random Unification
David Waite
david at alkaline-solutions.com
Sat Dec 2 00:23:23 CST 2017
> On Dec 1, 2017, at 11:05 AM, Erica Sadun via swift-evolution <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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171201/0f5737f7/attachment.html>
More information about the swift-evolution
mailing list