Type-directed filter logic for counting/accessing random choices from a trace.