Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Vitor
Posts:
1
Registered:
7/22/13


Generating sequence of 0s and 1s with no repetition
Posted:
Jul 22, 2013 1:32 PM


Hello. I need to generate a sequence of 100 numbers composed of 0s and 1s only. But I must guarantee that no more that 3 repetitions occur. For xample: 1 2 2 1 2 2 1 1 1 2 1... its ok 1 2 1 2 2 2 2 1 it's not. I used randi for the generation of the sequence. But i'm a bit stuuck with the remaining part. I'm sure there is an efficient way of achieving this. Thanks for any help.



