MATLAB: Random number within a decimal range

random decimals

How do I create a random number within the range 0.95 to 0.99? Any help is appreciated. Thanks in advance.

Best Answer

Hi Akif,
This is exactly a copy paste from MATLAB's help, so for further info type
doc rand
Your solution
r = a + (b-a).*rand(100,1);
Be aware, rand is generates evenly distributed random randi is the same but integer, But randn generates normally distributed random (gaussian distribution)
Good Luck!
Related Question