Generation of a pair of random numbers satisfying a constraint
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Shah Muhammad
am 6 Jul. 2021
Beantwortet: Stephan
am 6 Jul. 2021
Hi, guys, I want to generate s sequence of two random numbers r1 and r2 satisfying the condition 0<r1<r2<1. How to do it using MATLAB. Your response is highly appreciated. Thank you!
Shah
1 Kommentar
Johannes Hougaard
am 6 Jul. 2021
The easy way...but that also yields r1 < .5 and r2 > .5 is:
N = 99; % Or any other number but 99 is my go-to number of observations
r1 = rand(N,1)*.5;
r2 = randn(N,1)*.5 + .5;
Akzeptierte Antwort
Weitere Antworten (1)
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!