The probability distribution of the extent of a random chain