shuffle method

Float64List shuffle (Float64List a1, Float64List a2)

Merges the arrays a1 and a2 to a new array "result" with double size. The even indices of "result" will be filled with a1, the odd ones of a2. a1 and a2 must have the same length. See also method unshuffle.

Implementation

static Float64List shuffle(Float64List a1, Float64List a2) {
  if (a1.length != a2.length)
    throw "shuffle: Data lengths=${a1.length}/${a2.length} must be equal!";

  Float64List result = new Float64List(a1.length * 2);
  for (int i = 0; i < a1.length; i++) {
    result[2 * i] = a1[i];
    result[2 * i + 1] = a2[i];
  }
  return result;
}