first implementation of kolmogorov distance