Right—again, this is yet another difference between two things both named “random” in this proposal. Almost always, when we say “give me two random integers,” we want independent random samples from the set of all integers. But for collections, a very common (and probably more common operation) is to _sample without replacement_. Conflating the two is how hard-to-detect errors arise.<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 30, 2017 at 10:29 Martin Waitz via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Erica,<br>
<br>
> Doesn't `choose` usually take two arguments, the `count` to choose (presumably defaulting to 1) and the collection to choose `from`?<br>
<br>
This might be useful for collections, when you want to draw several elements without drawing the same element twice.<br>
For ranges of random numbers you usually need independent numbers and just call the generator multiple times.<br>
Both use cases could be provided as overloads (a default argument would require that the return value has the same type, which would be unfortunate here).<br>
<br>
--<br>
Martin<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>