[swift-users] Make getting a random number more intuitive
Jens Alfke
jens at mooseyard.com
Thu Jan 21 14:50:39 CST 2016
> On Jan 21, 2016, at 12:07 PM, Lukas Stabe via swift-users <swift-users at swift.org> wrote:
>
> In addition to not being very obvious, arc4random is also not supported on platforms other than OSX.
It’s also available in OpenBSD and FreeBSD.
> Be aware that the generators are not able to produce cryptographically secure random, and I’m pretty new to this field. I basically just ported some generators from http://xorshift.di.unimi.it/ <http://xorshift.di.unimi.it/> to Swift.
In general it’s better to provide a cryptographically-safe RNG, so people can’t accidentally use an insecure one in a context that needs security. Since every OS provides one of these, I think it’d be best for Swift to provide a single RNG API whose implementation calls the platform’s RNG.
—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160121/16f092da/attachment.html>
More information about the swift-users
mailing list