
Note:
public static boolean randomCoinFlip (double p)
{
if (UniformRandom.uniform() < p)
return true;
else
return false;
}
You can get UniformRandom
from here.
Suppose you want to randomly generate edges with an unbiased coin
(i.e., p = 0.5.
Each time you call randomCoinFlip with
p=0.5 you'll get true (if the flip is heads) or
false (if not).
Submission: