[swift-users] Sampling collections

Erica Sadun 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.

Best regards,

-- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160410/e980255c/attachment.html>


More information about the swift-users mailing list