Generate a rondom sequence
Afficher commentaires plus anciens
Greetings,
Please can any one help me about:
How to Generate Generate a random sequence Z ={(i, j)},
where i, j Belongs to {1, 2, 3, 4}, i not equal to j
i and j are selected randomly.
Best Regards
Réponse acceptée
Plus de réponses (2)
Youssef Khmou
le 15 Mar 2013
Modifié(e) : Youssef Khmou
le 15 Mar 2013
hi,
Random sequence derived from which distribution ?
Z=rand(4); % from Uniform distribution.
Z=randn(4); % from Normal distribution.
Z=random('rayl',(1:4)'*(1:4)) % from Rayleigh distribution
A basic approach, but dangerous as you don't know how much time it will take, could be..
ii = randi(4, 4, 1) ;
jj = randi(4, 4, 1) ;
while any(jj == ii)
jj = randi(4, 4, 1) ;
end
Z = [ii, jj]
If you don't want repetitions within ii or jj, you can use RANDPERM.
1 commentaire
abdulhakeem
le 15 Mar 2013
Catégories
En savoir plus sur Rayleigh Distribution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!