Generate 50000 binary sequence of 16 bits long (without repetition) without using "rand(1,16) > 0.5" logic

1 Ansicht (letzte 30 Tage)
Can anyone give me some idea on how can I generate 16 digit binary sequence (without repeating any sequence) 50000 times without using "rand(1,16) > 0.5" logic "rand(1,16) > 0.5" logic. For some reason I think that "rand(1,16) > 0.5" logic will give me repetition of the binary sequence.

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 8 Sep. 2019
Bearbeitet: Bruno Luong am 8 Sep. 2019
c=dec2bin(randperm(2^16,50000)-1,16)
a=c-'0' % if you need binary arrays

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by