shouldInterleave static method

bool shouldInterleave(
  1. int questionIndex, {
  2. double ratio = 0.25,
})

Whether the current question index should be an interleaved question.

At ratio = 0.25, roughly every 4th question is interleaved.

Implementation

static bool shouldInterleave(int questionIndex, {double ratio = 0.25}) {
  if (questionIndex < 3) return false; // at least 3 on-topic first
  final period = (1 / ratio).round();
  return questionIndex % period == 0;
}