The distribution of hard rods on a line of finite length