Problems Generating A Math.random Number, Either 0 or 1
You could use boolean values of 0 or 1 based on value of Math.random() as a double between 0.0 and 1.0 and make the random generator much simpler. And you can get rid completely of the coinToss() method. Remove the coin toss method and replace the first conditional with the code above. Math.random(); by itself will return a value between … Read more