How do I randomize a sequence of random numbers?
Show older comments
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!
Accepted Answer
More Answers (0)
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!