An algorithm for randomly generating integer partitions of a particular length, in Python?
问题 I've been using the random_element() function provided by SAGE to generate random integer partitions for a given integer ( N ) that are a particular length ( S ). I'm trying to generate unbiased random samples from the set of all partitions for given values of N and S . SAGE's function quickly returns random partitions for N (i.e. Partitions(N).random_element() ). However, it slows immensely when adding S (i.e. Partitions(N,length=S).random_element() ). Likewise, filtering out random