[swift-evolution] [Proposal] Random Unification

Jonathan Hull jhull at gbis.com
Thu Nov 30 18:02:02 CST 2017


> On Nov 30, 2017, at 3:52 PM, Dave DeLong <swift at davedelong.com> wrote:
> 
> What is the useful distinction between generating a random value, and choosing a random element from a collection of all possible values?

I don’t have to generate (or keep in memory) that collection.  

I gave an example before of an easy to add API for random colors which allow their saturation, lightness, and alpha to be fixed.  I use something very similar all the time in some graphics code I have (varying only the hue or saturation).  I also do the same with Sizes and CGVectors.  How would you represent that as a collection to choose an element from?

Also, for most of my use cases, I *need* to be able to plug in a repeatably random source… otherwise pixels will start jumping around the screen when people resize things.

Thanks,
Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171130/481f597a/attachment-0001.html>


More information about the swift-evolution mailing list