boolean function

bool boolean({
  1. int min = 5,
  2. int max = 10,
  3. bool def = true,
})

min/max probability will return def.

Implementation

bool boolean({int min = 5, int max = 10, bool def = true}) {
  return (_random.nextDouble() < min / max) ? def : !def;
}