Random Integers With a Specified Sum and Range

Version 1.0.0 (5,2 KB) von DGM
Generate random integers with specified sum and parameters from various distributions.
7 Downloads
Aktualisiert 4. Feb 2022

Lizenz anzeigen

The function randisum() can draw random integers from a specified distribution, subject to user-specified sum and boundary constraints. Supported distributions are 'uniform', 'skew', 'exponential', and 'gaussian'.
Consider the simplistic example:
% Subdivide a vector into 10 randomly-sized blocks
x = 1:100;
blocksizes = randisum(5,numel(x),[1 10]);
xc = mat2cell(x,1,blocksizes);
I make no claims that these are particularly efficient, robust, or statistically meaningful ways to solve this problem.
Webdocs for randisum():
These tools are part of the MIMT:

Zitieren als

DGM (2024). Random Integers With a Specified Sum and Range (https://www.mathworks.com/matlabcentral/fileexchange/106185-random-integers-with-a-specified-sum-and-range), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2019b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

randisumpkg

Version Veröffentlicht Versionshinweise
1.0.0