A stream transformer for sampling a stream based on an incremental count