Random numbers with custom distrbution
Version 1.0.2 (5.43 KB) by
William Rose
myRand returns random numbers with a custom distribution specified as a histogram.
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 LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
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 |