Crate random_partition

Source
Expand description

Generate approximately uniformly distributed random integer partitions. So given natural numbers n, k find a sequence of natural (nonzero) p₁, …, pₖ such that n = ∑ᵢ₌₁ᵏ pᵢ.

Functions§

number_of_partitions_into_parts
number_of_partitions_into_parts_with_max
random_partition
Generates a random partition of total into number_of_parts.
random_partition_buf
Generates a random partition of total into number_of_parts writing the result into the provided buffer.
random_partitions
Generates multiple random partitions of total into number_of_parts.