diff --git a/src/main/scala/org/xcit/nback/generators/SkewedSequenceGenerator.scala b/src/main/scala/org/xcit/nback/generators/SkewedSequenceGenerator.scala index fd99caa..a54b5a4 100644 --- a/src/main/scala/org/xcit/nback/generators/SkewedSequenceGenerator.scala +++ b/src/main/scala/org/xcit/nback/generators/SkewedSequenceGenerator.scala @@ -50,7 +50,7 @@ // 2. For each trial, generate a random type (L1, L2, T, or D) // 3. Based on the generated type, generate the item and append it to the buffer - buffer += {nextTrialType() match { + buffer += {nextTrialType(trials-trial) match { case TrialType.LURE_BEFORE_TARGET if buffer.length > N + 1 => buffer(buffer.length - (N + 2)) case TrialType.TARGET if buffer.length > N => @@ -68,10 +68,10 @@ /** * Defines next trial types randomly. It returns L1, L2, T, or D (Ralph2014). - * Random range: [1, trials] (both are inclusive based on ralph2014!) + * Random range: [1, remaining_trials] (both are inclusive) * @return a trial type to be used to generate an item for current trial */ - private def nextTrialType(): TrialType.Value = { Random.nextInt(trials + 1) + 1 } match { + private def nextTrialType(remainingTrials: Int): TrialType.Value = { Random.nextInt(remainingTrials + 1) + 1 } match { case rnd if rnd <= L1 => L1 -= 1 TrialType.LURE_BEFORE_TARGET