Random numbers with custom distrbution

myRand returns random numbers with a custom distribution specified as a histogram.
0 Downloads
Updated 4 Sep 2024

View License

myRand() returns random numbers with a custom distribution, where the distribution is specified like a histogram. It is useful if you want to reproduce a distribution that is not one of the built-in, named distributions. For example, to reproduce the distribution of an experimentally measured variable, use Matlab's histcounts() to estimate the distribution, then use myRand() to generate random numbers with the same distribution. This is useful for Monte Carlo simulations and other statistical testing.

Cite As

William Rose (2024). Random numbers with custom distrbution (https://www.mathworks.com/matlabcentral/fileexchange/171874-random-numbers-with-custom-distrbution), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.2

Fixing upload error on v.1.0.1.

1.0.1

A sample data file has been added to show how myRand() can generate random numbers with the same distribution as measured data. The test script, myRandTest.m, has been updated to demonstrate how to do it. myrand() itself is unchanged.

1.0.0