random vectorof zeros and 1

1 view (last 30 days)
joseph Frank
joseph Frank on 20 Apr 2013
if I want to generate a random vector of length 1000 where 700 are zeros and 300 are ones how can I do so? I want the zeros and ones to be have a random occurrence in the vector. for example:
A=[ 1 0 1 1 0 1 0 0 .....1] % till observation 1000;

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 20 Apr 2013

More Answers (0)


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!

Translated by