My idea is to create a two-dimensional array using c, that prints values randomly, the range I defined was between 0 and 1, one example:
srand(time(NULL));
arr[6][6] = rand()%2;
When I loop through the array it generates an output like this:
110111
111101
111111
101111
101011
100001
so far so good, the problem comes when I try to uniformly distribute the probability with which the numbers are generated, that is, that the probability of generating 1 is the same as that of 0, for example an array where half of its values are a number and the other half another number, in this case 1 and 0.
I appreciate any help
Aucun commentaire:
Enregistrer un commentaire