A Google search reveals plenty about generating all possible partitions of an integer n into m parts, but I haven\'t found anything about sampling a uniformly distributed ra
Another algorithm from Combinatorial Algorithms page 52, "Random Generation of n into k parts"
a1, a2, .. , ak-1 a random k-1 subset of {1,2,..,n+k-1} (see below 1., 2.)r1 = a1-1; rj = aj - aj-1-1 (j=2..k-1); rk = n+k-1- ak-1rj (j=1..k) constitute the random partition of n into k partsThis algorithm for random compositions is based on the "balls-in-cells" model.
Briefly we choose the posiitons of the cell boundaries at random, then by differencing we find out how many balls are in each cell.
For efficiently generating a random subset of a set, see a 1. related answer here and 2. here
update
Another approach using a single random number in [0,1] to uniformly generate a random partition (also called composition) is given in IVAN STOJMENOVIC, "ON RANDOM AND ADAPTIVE PARALLEL GENERATION OF COMBINATORIAL OBJECTS" (section 5, section 10)