Generation of distribution file (copied from rats2)