MATLAB: Can I set a probability distribution in rand()

rand() probability

Hey everyone,
I need to generate some random values, but I have a specific distribution for this values. Can I set this probability inside rand()? P=1\(1+(x\31).^2.6)

Best Answer

Yes. See this: https://en.wikipedia.org/wiki/Inverse_transform_sampling. In short, compute the CDF and inverse sample it. I attach a Rayleigh example.