MATLAB: How to generate integer random variables by using exponentially distributed with a mean of 20 seconds exponentially distributedrandom variables I used this code that you see in below but this all values, I generate, not integer: mu2 = 20; sz1 = 50; sz2 = 1; r2 = exprnd(mu2,sz1,sz2) Best Answer If you just want integers, then use the geometric distribution instead of the exponential:r2 = geornd(1/mu2,sz1,sz2); Related SolutionsMATLAB: Generate multiple random numbers in MatLab mu = 1; x = exprnd(mu,1000,1); hist(x)MATLAB random number generators all work like this; this is documented in the command line help and the documentation. Have you read that? MATLAB: Random exponential cdf numbers mu = 2 % mean of distributionx = -mu*log(1-rand(1,10)); % ten numbers Related QuestionGenerate n random number between two numbers follow exponential distributionCreating an array with exprnd numbersSetting Limits on a Random Number GenerationExponential distributed random values
Best Answer