Without that: Let be the number of partitions of whose largest part is at most . We can quickly compute a table of values of by the recursion .

We then write a recursive function which builds a random partition of with largest part at most : If , return . Otherwise, choose an integer between and with probability and return , where is the output of .

I had this implemented and it ran pretty much instantly up to or so, when I discovered that Mathematica already had a function to do this.

]]>