[swift-users] Sampling collections
erica at ericasadun.com
Sun Apr 10 15:23:44 CDT 2016
> On Apr 10, 2016, at 2:00 PM, Milos Rankovic via swift-users <swift-users at swift.org> wrote:
> Thank you, Jens, for your response.
> I do however disagree with both points you are making. First, you write that sampling collection elements at random is:
>> a pretty obscure feature
> But how can this be? When you teach students how to implement a card playing game in Swift, how do you shuffle the deck? And when you test your code, do you not feed your methods with randomly generated and sampled simulated data, or do so at random intervals? And when you’re simply checking out an idea in the playground, do you not want randomly sampled or reshuffled inputs? Should any of these activities qualify as obscure?
I personally would vote against this. I do not think it's the role of a core language to worry about things like distributions, bias, and sampling.
At the same time, I agree it's a very common task for playgrounds. I've developed a lot of material for everything from random colors and shapes to placeholder APIs to shuffles.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users