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

1 vue (au cours des 30 derniers jours)
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.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by