Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Generating sequence of 0s and 1s with no repetition
Replies: 3   Last Post: Jul 22, 2013 2:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Vitor

Posts: 1
Registered: 7/22/13
Generating sequence of 0s and 1s with no repetition
Posted: Jul 22, 2013 1:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.