How to generate a random decimal number between 1.0 and 1.52?

4 views (last 30 days)
rand([1.0,1]);
May I know why this is not working?

Accepted Answer

Ameer Hamza
Ameer Hamza on 29 Oct 2020
Edited: Ameer Hamza on 29 Oct 2020
You can generate them by scaling and translating the output of rand()
range = [1.0,1.52];
x = rand()*diff(range)+range(1)

More Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!