[SR-8779] UnsignedInteger constraint on RandomNumberGenerator is not ideal #51287
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 7065369b6f42acb03b6e059f6af05a15
Issue Description:
Lack of a better bug title, these extension methods on RandomNumberGenerator:
are somewhat difficult to work with. Here is the implementation of randomElement() on Collection:
Granted the numericCast might be unnecessary and you can achieve the same using Int(random), but removing the UnsignedInteger constraint allows for an implementation like so:
This is just one example of where removing this constraint is helpful.
The text was updated successfully, but these errors were encountered: