NumDart

Random arrays

Uniform random arrays for tests and simulations.

Random arraysUniform random arrays of real and complex values.
import 'package:scidart/numdart.dart';

void main() {
  var a = randomArray(5);
  print(
      'length ${a.length}, all in [0, 1): ${a.every((v) => v >= 0 && v < 1)}');
  var m = randomArray2d(2, 3);
  print('matrix ${m.length} x ${m[0].length}');
  print('complex values: ${randomArrayComplex(2).length}');
}
Output
length 5, all in [0, 1): true
matrix 2 x 3
complex values: 2

randomArray, randomArray2d and randomArrayComplex draw uniform values in [0, 1). For normally distributed samples with a fixed seed, use NormalDistribution.sample from the Normal distribution guide.

Edit this guide on GitHub