@huon notes that a consuming randomElement
on Collection
would not be particularly useful. Would it make sense to change the protocol requirement to be randomIndex
, producing a random valid, non-end Index
for the collection, and make randomElement
be an extension method instead?
3 Likes