This is a small improvement, but I still think it is worthwhile.

I would like to see an 'init(randomIn: Range<Self>)’ added to Numeric (where 
Comparable), which would return a random number in the given range.  It is 
something I have added myself to a subset of number types, but it really should 
be part of the standard library since there are a million small number types 
that have to be added individually, there are a couple of tricky edge cases to 
get right, and my version won’t work with Numeric types added by others.

I would also like to see a ‘randomElement’ method added to collection.  This is 
much easier to get right ourselves, but it comes up often enough in generic 
code that I still think it is a worthwhile addition…

Thanks,
Jon
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to