Generators as reference vs value types
I think we should require Generators to be classes. It simplifies calling the functions and I don't see any clear advantage of using struct Generators.
Static versus free functions
I have mixed feeling about this one.
-
Type.random(in:)feels more swifty for me. -
random(in: Range<T>)seems more easy to find for all types.
In any case I would maintain the argument label.
Naming of Collection.random
I agree that we should name it Collection.randomElement and it should return an optional value.