How can I choose non-repeating values with a probability of 90% and 10% ?
Ältere Kommentare anzeigen
Hello friends, how can I choose values that do not repeat with a probability of 90% and 10%?
let me explain myself better.
For example I have a vector:
vector = [43 19 63 60 19 27 6]
So what I have done so far with my algorithm is that if the numbers that are inside the vector are not repeated, I assign a binary code of "1", on the other hand, if any number inside the vector is repeated, I assign a binary code of "0". ", as can be seen in the image below.

now I want to solve the following problem, that, if the numbers within the vector are not repeated, they have a 90% probability of assigning the binary code "1" and a 10% probability of assigning the binary code "0", on the other hand if the numbers within the vector are repeated with a 100% probability of being assigned the binary code "0".
for example:
taking the variable :
vector = [43 19 63 60 19 27 6]
numbers that are not repeated we have 43,63,60,27 and 6.
then it would have to be randomly assigned the binary code "1" with a 90% probability and the binary code "0" with a 10% probability.
taking into account that the probability is assigned randomly
then the result would be something like this.
I touch 90% to 43 so it is assigned the binary code "1"
I touch 90% to 63 so it is assigned the binary code "1"
I touch 10% to 60 so it is assigned the binary code "0"
I touch 90% to 27 so it is assigned the binary code "1"
I touch 90% to 6 so it is assigned the binary code "1"
Now the repeated numbers of the vector are 19,19.
then with 100% the binary code of "0" is assigned
19 is assigned the binary code "0" >> with 100%
19 is assigned the binary code "0" >> with 100%
in the end my matrix would look like this
43 "1"
19 "0"
63 "1"
60 "0"
19 "0"
27 "1"
6 "1"
thank you very much in advance
1 Kommentar
Wasseem Khardawi
am 19 Feb. 2022
if you share the code, maybe i can help
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu LTE Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!