getBit static method

int getBit([
  1. double chance = 0.5
])

Implementation

static int getBit([double chance = 0.5]) {
  return random.nextDouble() < chance ? 1 : 0;
}