timyates/groovy-common-extensions — pull request #9 by ataylor284 (2013-09-11 18:42:00+00:00)
Title: Added rand methods to Iterator.

This change adds rand methods to Iterator similar to those on List. A single item is chosen from those iterated over with uniform probability.

Inspired by this blog post on sampling a stream of unknown size: http://jeremykun.com/2013/07/05/reservoir-sampling/