gaussian method

Stream<double> gaussian(
  1. double sigma, {
  2. int? maxCount,
})

The method transforms the state using the MWC algorithm and returns the next random number from the Gaussian distribution N(0,sigma) . That is, the mean value of the returned random numbers is zero and the standard deviation is the specified sigma . https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8df8ce4dc7d15916cee743e5a884639d

Implementation

Stream<double> gaussian(double sigma, {int? maxCount}) async* {
  int count = 0;
  final p = calloc<ffi.Double>();
  try {
    while (true) {
      cvRun(() => cffi.RNG_Gaussian(ref, sigma, p));
      yield p.value;

      count++;
      if (maxCount != null && ++count >= maxCount) break;
    }
  } finally {
    calloc.free(p);
  }
}