Closed rainyl closed 4 months ago
make Rng.uniform, next, gaussian and async version of them return Stream
final rng = cv.Rng(); final v = await rng.uniformAsync(0, 241, maxCount: 100000).take(10000).toList(); expect(v, everyElement(greaterThanOrEqualTo(0))); final v1 = await rng.uniformAsync(2.41, 241.0).take(100000).toList(); expect(v1, everyElement(greaterThanOrEqualTo(2.41))); final v = await rng.gaussian(2.41).take(100000).toList(); expect(v.length, equals(100000)); final v1 = await rng.next().first; expect(v1, isA<int>());
final rng = await cv.RngAsync.createAsync(); final v = await rng.uniformAsync(0, 241, maxCount: 10000).take(10000).toList(); expect(v, everyElement(greaterThanOrEqualTo(0))); final v1 = await rng.uniformAsync(2.41, 241.0).take(10000).toList(); expect(v1, everyElement(greaterThanOrEqualTo(2.41))); final v = await rng.gaussianAsync(2.41).take(10000).toList(); expect(v.length, equals(10000)); final v1 = await rng.nextAsync().first; expect(v1, isA<int>());
make Rng.uniform, next, gaussian and async version of them return Stream