Distance generation.