Sequence differs from
List in another way.
List is a fixed set of items.
Sequence, on the other hand, can be generated on the fly, such as via
generateSequence() global function.
generateSequence() takes a lambda expression, and it emits the result
of evaluating that lambda expression, over and over as downstream consumers
pull items from the resulting
Sequence. Once the lambda expression returns
Sequence ends, and no more items are emitted.
In this case,
percentileDice() will return a random number from 1 to 100.
generateSequence() will return a stream of random
numbers, until the next number exceeds 95, at which point the
Sequence has a
toList() function that collects all the emitted items and
puts them in a
List, which is useful here just for printing the results.