shuffle method

DartBlockProgram shuffle({
  1. bool deep = false,
})

Randomly re-order the statements in the main function, as well as the custom functions.

If the 'deep' parameter is false, the shuffling will only be at the highest level, i.e., nested statements will not have their statements shuffled.

Otherwise, all statements will be shuffled, e.g., a for-loop's body will also be shuffled.

Implementation

DartBlockProgram shuffle({bool deep = false}) {
  return DartBlockProgram(
    mainLanguage,
    mainFunction.shuffle(deep: deep),
    customFunctions.map((e) => e.shuffle(deep: deep)).toList(),
    version,
  );
}