RANDRAW
EFFICIENT RANDOM VARIATES GENERATOR (from over 50 distributions):
Alpha,
Anglit,
Antilognormal,
Arcsin,
Bernoulli,
Bessel,
Beta,
Binomial,
Bradford,
Burr,
Cauchy,
Chi,
Chi-Square (Non-Central),
Chi-Square (Central),
Cobb-Douglas,
Cosine,
Double-Exponential,
Erlang,
Exponential,
Extreme-Value,
F (Central),
F (Non-Central),
Fisher-Tippett,
Fisk,
Frechet,
Furry,
Gamma,
Generalized Inverse Gaussian,
Generalized Hyperbolic,
Geometric,
Gompertz,
Gumbel,
Half-Cosine,
Hyperbolic Secant,
Hypergeometric,
Inverse Gaussian,
Laplace,
Logistic,
Lognormal,
Lomax,
Lorentz,
Maxwell,
Nakagami,
Negative Binomial,
Normal,
Normal-Inverse-Gaussian (NIG),
Pareto,
Pareto2,
Pascal,
Planck,
Poisson,
Quadratic,
Rademacher,
Rayleigh,
Rice,
Semicircle,
Skellam,
Student's-t,
Triangular,
Truncated Normal,
Tukey-Lambda,
U-shape,
Uniform (continuous),
Von Mises,
Wald,
Weibull,
Wigner Semicircle,
Yule,
Zeta,
Zipf
Alex Bar-Guy (2021). RANDRAW (https://www.mathworks.com/matlabcentral/fileexchange/7309-randraw), MATLAB Central File Exchange. Retrieved .
Inspired: Compound Poisson simulation, Dynamic Copula Toolbox version 1
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Solved my Maxwell-Boltzmann issues!
great job and very comprehensive work. thanks for sharing!
Really usefull to generate aleatory number with a lognormal distribution.
Really impressive!...Thank you!!!
Excelent!! thank you
Extensive work! Thank you.
There appears to be an issue with the beta distribution:
>> histogram(randraw('beta',[1, 2],1e5));
has a very different appearance than it should:
https://www.wolframalpha.com/input/?i=beta+distribution+a%3D1+b+%3D2
Extensive work! Thank you!
how can I get doc of Generalized Inverse Gaussian
I would see the density. I typed doc randraw(Generalized Inverse Gaussian) but no thing appear.
You saved me!!! many thanks!
Thank you very much !
Gorgeous. Many Thanks
Impressive. Many thanks
Extremely useful!
very good work. thank you for sharing with us.
I have a question:
Who could I plot a diagram like this one you show?
Great help. Thank you very much for the neat code.
Burr Dist: pdf should be:
pdf(y) = c*d * y.^(-c-1) .* (1+y.^c).^(-d-1)
(minus sign in front of power of c)
Dear Sir, thank you for your code. I am interesting in alpha-mu distribution. Can you help me to generate this this random variable according to this distribution.
maaljarrah08@eng.just.edu.jo
Excellent
excellent work
Using - 'randraw('bessel', [2 0.9], [1 1e5])' I get an error message:
??? Attempted to access EE(7.46288e+008); index out of bounds because numel(EE)=1.
Error in ==> randraw>randFrom5Tbls at 4373
out(ii) = EE(floor(jj(ii)-t4) + 1);
Error in ==> randraw at 807
out = randFrom5Tbls( P, offset, sampleSize);
Error in ==> DG_IS_gamrnd_BS_Probe at 100
n0 = randraw('bessel', [v z], 1);
What is the Problem with the Bessel Generator?
Hmm... really helped a lot.!
Generally very useful. Agree that this ought to be standard in Matlab w/o toolboxes.
However, there seems to be a bug in 'beta'. When I have a=1, b>1 I get a kink in the cdf at x=0.5 and it does not follow betainc as expected.
As soon as I have a>1, even a=1.000001, this kink goes away and the cdf matches betainc perfectly. Any ideas what's going on?
excellent!!
Thanks, this is very useful.
A minor bug in the beta distribution code - the last line in the case statement is
reshape( out, SampleSizeIn );
but it needs
out = reshape( out, SampleSizeIn );
to work.
I'm not sure if anyone has pointed it out, but binomial seems to have a bug:
You define switchflag within a if-else clause in line 881, but it needs to be defined outside it, since, after the clause, you write:
Line 935: if switchFlag
Did old versions of Matlab support use of variables outside what's meant to be their scope?
this is an excellent work.
This is excellent, and is yet another FEX submission that should be part of standard Matlab sans toolboxes.
and the multivariate case?
It's a wonderful job
Great program for various distribution generation.
Your program helps me very much in GIG random generator! thank you! I do a progrom by myself,but its efficiency is poor.
incluing Nakagami-m distribution would have made it perfect
Thanks
Very good, but the help-text keeps rolling off my screen. Perhaps some sort of printable documentation?
random
It works excellent for me :)
Hi, with regard to Xudong Wang's request for Rician samples, you are welcome to take the (very simple) code from my toolbox and adapt it to randraw.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14237&objectType=FILE
Best,
Ged.
This code is great! The HELP is also wonderfully organized.
If it had included Ricean,Nakagami-m distributions, this program would be perfect.
thanks a lot for your excellent work!
Many thanks for this truly excellent code. In particular, the organization of HELP is remarkable.
thanks
Nice work !
Fast operations .
No more needs for many Libraries .
very useful.Thanks!
prevent me from switching to SAS.
Excellent
Absolutely Fantastic - you are a star!
Thanks for sharing it with us!
Great worl, thanks for sharing this useful script.
y = randraw('uniform', [2, 3], 1, 1e5);
I am getting the following error message if i execute the above statement. But if i am not specifying any parameter a & b, it works fine. Can u help me with it.
??? Undefined function or variable 'true'.
Error in ==> D:\Random\randraw.m (validateParam)
On line 4105 ==> condLogical = true;
Error in ==> D:\Random\randraw.m
On line 3751 ==> validateParam(funcName, 'Uniform', 'uniform', '[a, b]', 'b-a', b-a, {'> 0'});
Very, very useful!!!
Thanks
Excellent work!!! Thanks for GIG random variables generator !!!
Most of this program seems pretty good. There's a bit of bug in the gamma code. The reference they cite has a different algorithm for alpha < 1 which is omitted in the code causing trouble, particularly if try and set alpha = 1/3.
Great and very useful work!
If I had confidence in the program it would be great.
I tried the program with poisson distribution help, i.e. randraw( 'po') but it produced an error message. See below.
Maybe the problem is similar to the binomial
distribution problem noted in the 4/14/05
change.
This is a great piece of work, but unless
there is confidence in the accuracy of the
program it is not very useful.
Here is the problem I encountered.
--------------------------------------
Input:
randraw( 'po')
The output is an error:
??? if h<=1 &&
Missing variable or function.
Syntax error...
On line 1799
--------------------------------------
Great work! Thank you very much for sharing this with us!
Comprehensive random variable generator. Excellent work.