getSign static method

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

Implementation

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