How to generate the random number with restrictions?
Ältere Kommentare anzeigen
For [1 2 3 ........35], I want to generate random number but the restriction is i want random numbers from [1 2 3...28] as [1 5 9 13 17 21 25] and then after any random number from [29 30 ...35] as normal.
Akzeptierte Antwort
Weitere Antworten (1)
Andrei Bobrov
am 7 Jan. 2016
a1 = 1:28
a2 = 29:35
out = [a1(randperm(numel(a1),7)),a2(randi(numel(a2)))]
1 Kommentar
Raja R
am 8 Jan. 2016
Kategorien
Mehr zu Random Number Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!