@Override
    protected boolean filter(final Traverser.Admin<S> traverser) {
        long newBulk = 0l;
        if (traverser.bulk() < 100) {
            for (int i = 0; i < traverser.bulk(); i++) {
                if (this.probability.get() >= random.nextDouble())
                    newBulk++;
            }
        } else {
            newBulk = Math.round(this.probability.get() * traverser.bulk());
        }
        if (0 == newBulk) return false;
        traverser.setBulk(newBulk);
        return true;
    }
A filter step that will randomly allow traversers to pass through the step based on a probability value.

@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java