dice_dist function

Dice distance (lowlevel function)