MATLAB: Random numbers between a and b with specified mean and variance

random

I am using a + b*rand() to create uniformly distributed variables between [a,b]. But I want to create the same with a specified mean and variance. Is there a way to do so in matlab?

Best Answer

1) a + b*rand() creates a value between a and a+b, not between a and b.
2) The values will have a uniform distribution with mean and variance fixed depending on a and b. If you want other mean and variance values then you either need a different a and b or you need a different distribution. Please specify what exactly you want.