sampleList method Null safety

List<T> sampleList(
  1. int length,
  2. {Random? random}
)

Generates a list of N random samples.

Example

import 'package:calc/calc.dart';

void main() {
  final distribution = NormalDistribution(mean=0.0, variance:1.0);
  final sampleList = distribution.sampleList(100);
}

Implementation

List<T> sampleList(int length, {Random? random}) {
  random ??= Random();
  return List<T>.generate(length, (i) => sample(random: random));
}