I want generate a number in Gaussian and Uniform distributions in matlab.
I know this function randi
and rand()
but all of them are in normal (Gaussian) distribution. How can a generate a random number in uniform distribution?
Use rand(dimensions)
for a Uniform Distribution between 0 and 1.
Use randn(dimensions) * sqrt(sigma) + mu
for a Gaussian Distribution with a mean of mu and variance of sigma.