nextBoolean method

bool nextBoolean({
  1. double odds = 0.5,
})

Returns a random boolean based on the given odds.

Implementation

bool nextBoolean({double odds = 0.5}) {
  if (odds < 0 || odds > 1) {
    throw ArgumentError.value(odds, 'odds', 'Must be between 0 and 1');
  }
  return nextDouble() < odds;
}