## A Java method that returns a random boolean value based on a probability

If you ever need a Java method that returns a boolean value based on a given probability, I can confirm that this method works:

```
/**
* `probability` should be given as a percentage, such as
* 10.0 (10.0%) or 25.5 (25.5%). As an example, if `probability`
* is 60% (60.0), 100 calls to this function should return ~60
* `true` values.
* (Note that Math.random returns a value >= 0.0 and < 1.0.)
*/
static boolean getRandomBoolean(float probability) {
double randomValue = Math.random()*100; //0.0 to 99.9
return randomValue <= probability;
}
```