The following algorithm provides uniformly distributed partitions, assuming that it is possible to generate uniformly distributed random numbers over a continuous range (or, at least, over a discrete range with sufficiently many possible values that the odds of duplication are negligible).
To produce a partition of t
into k
values:
Generate k-1
uniformly distributed values in the range [0, t]
.
Sort them, and add 0
at the beginning and t
at the end.
Use the adjacent differences as the partition.