Here is a sample code that distributes randomly values of -1,+1 in an array of size N
N=100;
D = sign(rand(1,N)-0.5).*ones(1,N);
How can I control the level of bias in the distribution of the numbers?
let's say for example, that only 20% of the array will have +1, and the rest -1
Aucun commentaire:
Enregistrer un commentaire