Pink noise function from JOS
Optimized dist, especially for repeated calls on one argument