sample method

bool sample(
  1. BigInt seed
)

Whether seed, a 64-bit value, is sampled at samplingRate.

Implementation

bool sample(BigInt seed) {
  if (samplingRate == 100.0) return true;

  final hash = (seed * _knuthFactor) & _maxUint64;
  final threshold =
      BigInt.from(_maxUint64.toDouble() * (samplingRate / 100.0));
  return hash < threshold;
}