How do I randomize a sequence of random numbers?
Afficher commentaires plus anciens
Hi,
I've created a random sequence of numbers as shown below, but right now it just repeats the first 8 random numbers 13 times. How can I get it so that each sequence of 8 numbers is truly random from the next?
a = randi([1 4]);
b = randi([1 4]);
c = randi([1 4]);
d = randi([1 4]);
ASRTT = ([1 (a) 2 (b) 3 (c) 4 (d)]);
seqVectorX = repmat(ASRTT,1,13)';
Here's an example of the first two sequences for reference, where you can see the first 8 numbers are just starting over:
1 3 2 4 3 4 4 4 1 3 2 4 3 4 4 4
I added the line below but then it just scrambled all the numbers and didn't keep the ASRTT seqence of 1, random number, 2, random number, 3, random number, 4, random number.
seqVectorX= seqVectorX(randperm(numel(seqVectorX)));
Thanks in advance for any advice!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Random Number Generation 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!