using System.Collections.Generic;
public class StimGenerator
private double percentNoGo;
private int noGoDistance;
private int currentDistance;
public StimGenerator(int sessionNum, int blockNum, int noGo, double percentNoGo, int noGoDistance) {
this.random = new Random(sessionNum * 1000 + blockNum);
List<int> allNumbers = new List<int> {1,2,3,4,5,6,7,8,9};
this.percentNoGo = percentNoGo;
this.noGoDistance = noGoDistance;
this.currentDistance = 0;
double next = this.random.NextDouble();
if (this.currentDistance > this.noGoDistance && next < this.percentNoGo) {
this.currentDistance = 0;
return this.rest[this.random.Next(8)];
public static void Main()
StimGenerator sg = new StimGenerator(1, 1, 3, 0.10, 5);
for (int i=0; i<50; i++) {
Console.Write(sg.NextStim());
Console.WriteLine("\n---");
StimGenerator sg2 = new StimGenerator(1, 1, 3, 0.10, 5);
for (int i=0; i<50; i++) {
Console.Write(sg2.NextStim());
Console.WriteLine("\n---");
StimGenerator sg3 = new StimGenerator(1, 2, 3, 0.10, 5);
for (int i=0; i<50; i++) {
Console.Write(sg3.NextStim());
Console.WriteLine("\n---");
StimGenerator sg4 = new StimGenerator(2, 21, 3, 0.10, 5);
for (int i=0; i<50; i++) {
Console.Write(sg4.NextStim());
Console.WriteLine("\n---");