uniform method
returns uniformly distributed integer random number from [a,b) range The methods transform the state using the MWC algorithm and return the next uniformly-distributed random number of the specified type, deduced from the input parameter type, from the range [a, b) . https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8325cc562269b47bcac2343639b6fafc
Implementation
Stream<num> uniform(num a, num b, {int? maxCount}) async* {
int count = 0;
if (a is int && b is int) {
final p = calloc<ffi.Int>();
try {
while (true) {
cvRun(() => ccore.RNG_Uniform(ref, a, b, p));
yield p.value;
count++;
if (maxCount != null && ++count >= maxCount) break;
}
} finally {
calloc.free(p);
}
} else {
final p = calloc<ffi.Double>();
try {
while (true) {
cvRun(() => ccore.RNG_UniformDouble(ref, a.toDouble(), b.toDouble(), p));
yield p.value;
count++;
if (maxCount != null && ++count >= maxCount) break;
}
} finally {
calloc.free(p);
}
}
}