[swift-evolution] [Proposal] Random Unification
Jonathan Hull
jhull at gbis.com
Thu Jan 11 03:26:33 CST 2018
> On Jan 10, 2018, at 4:42 PM, Nate Cook <natecook at apple.com> wrote:
>
> I don’t see how a single distribution would generate both integers and colors. Can your color type be initialized from an integer? Since the “distributions” in that playground are just sequences, you could add .lazy.map({ Color(value: $0) }) to transform an integer-producing distribution into a color-producing one. (Which is pretty cool, tbh.)
See my other email for details, but it is essentially initialized from a sequence of 2-4 UInt* (one for each axis). I usually fix all but one dimension for aesthetic reasons though, so yes-ish**.
Thanks,
Jon
* I do mean UInt, and not UInt32 or UInt64. The amount of randomness it grabs is based on the word size of the platform, since CGFloats are as well.
** It currently naively still burns 2-4 UInt worth of randomness even if the axises are fixed, but it is ignoring 1-3 of the numbers in that case and only really using 1. I could easily optimize this without changing the interface though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180111/b4860545/attachment.html>
More information about the swift-evolution
mailing list