How o generate random integer value?
Mostra commenti meno recenti
Example:
I have used
A=randi([1 10],1,12)
output:
A=[ 1 9 1 6 7 8 3 7 9 7 8 5]
Is it possible to generate random integer values in interval [1 10], excluding 3, 6 and 8 from the interval having said that the size of the array 1 by 12 remains same?
Risposta accettata
Più risposte (1)
madhan ravi
il 15 Lug 2020
a = 1:10;
No_vals = [3, 6, 8];
A = setdiff(a, No_vals);
Wanted = A(randi(numel(A), [1, 12]))
1 Commento
SM
il 16 Lug 2020
Categorie
Scopri di più su Linear Algebra in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!