- All Implemented Interfaces:
- FilterPipe<S>, Pipe<S,S>, Iterable<S>, Iterator<S>
public class RandomFilterPipe<S>
extends AbstractPipe<S,S>
implements FilterPipe<S>
The RandomFilterPipe filters out objects that pass through it using a biased coin.
For each passing object, a random number generator creates a double value between 0 and 1.
If the randomly generated double is less than or equal the provided bias, then the object is allowed to pass.
If the randomly generated double is greater than the provided bias, then the object is not allowed to pass.
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)