Generating random decimals with a range
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
chantel
am 1 Okt. 2023
Kommentiert: chantel
am 3 Okt. 2023
I need to create a table using random numbers, i am having an issue with getting correct digits within a specified range. The range is 500.57 to 2000.75 and the random numbers must be 2 decimals
0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 1 Okt. 2023
%Change the display format
format longg
%Generate random number between [min max]*10^(num_of_demicals)
%and divide the output by 10^(num_of_demicals)
y = randi([50057 200075],10,1)/100;
disp(y)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!