I'm trying to make an Exponential Random number generator in matlab. Life would be easy if I could just use exprand but nope :( this is the function I have I want to see if it's correct.
function x=erv(lambda)%generatae Exponential random variables
x=(-(1/lambda)*log(urv(1)));%using the urv function from 1a
end
So the URV function give me a random number from [0,1]
function y=urv(howMany) %generate random numbers between [0,1] (uniform random variable), input how many RV's you want
for k=(1:howMany)
y(:,k)=(2*eps)*round(rand/(2*eps));
end
end
So can anyone give me any insight if URV is correct and if erv is correct. Thanx