randomArrayComplex function Null safety

ArrayComplex randomArrayComplex(
  1. int n

Generates a ArrayComplex with n elements containing non-negative random floating point value uniformly distributed complex numbers in the range from 0.0, inclusive, to 1.0, exclusive.

  • n : length of array


var x = randomArrayComplex(20);


ArrayComplex randomArrayComplex(int n) {
  var rng = Random();
  var l =
      List.generate(n, (_) => Complex.ri(rng.nextDouble(), rng.nextDouble()));
  return ArrayComplex(l);