I have the function mutateSequence that takes in three parameters. The parameter p is a value between 0 and 1, inclusive. I need two if statements, one that is entered with probability 4p/5 and another that is entered with probability p/5. How do I write the logic to make this happen?
Code:
void mutateSequence(vector<pair<string, string>> v, int k, double p)
{
for (int i = 0; i < k - 1; i++)
{
string subjectSequence = v[i].second;
for (int j = 0; j < subjectSequence.length(); j++)
{
// with probability 4p/5 replace the nucelotide randomly
if (//enter with probability of 4p/5)
{
//do something
}
if (//enter with probability of p/5)
{
//do something
}
}
}
}
I am expecting that the first if statement is entered with probability 4p/5 and the second if statement is entered with probability p/5