Is there a way to "shuffle" up an Iterable
(or Sequence
), such that elements are subsequently ordered randomly, similar to Java's Collections.shuffle()
? I've looked in the API docs for Iterable
, Collection
, and Sequence
, but haven't found anything relevant. (Side note: ceylon.language::shuffle
is confusingly named)
I could implement a shuffle myself I suppose, but I'm busy trying to be lazy :-)
I also went looking for this and couldn't find it. Here's an implementation: