I want to generate a random binary sequence with a ratio of 50%, that is, the same amounts of 0s and 1s. This is what I have so far:
length_sequence = 1000;
ratio = 0.5;
A = logical(randi([0 1],length_sequence,1));
The only problem is that I dont know how to set the ratio.
Aucun commentaire:
Enregistrer un commentaire