I like this idea. Did you intend to use f to throw exceptions with some probability? It's not currently being used in this code though.