Restricted integer compositions with fixed number of parts

Generate all restricted integer compositions with fixed number of parts, each in the interval [a,b]

You are now following this Submission

Matlab implementation of an algorithm that generates all restricted integer compositions of an integer n with k parts, each in the discrete interval [a,b].

The algorithm is based on
Vincent Vajnovszki, Generating permutations with a given major index, http://arxiv.org/abs/1302.6558

(Algorithm in Figure 2). The algorithm appears to be (much) faster than, e.g., the competing JD Opdyke algorithm for the same task.

Cite As

iuvaris (2026). Restricted integer compositions with fixed number of parts (https://www.mathworks.com/matlabcentral/fileexchange/44186-restricted-integer-compositions-with-fixed-number-of-parts), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Random Number Generation in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0