bool32 active
bool32.rising trigger
bool32.rising reset
frac32.positive wave
int res;
int gate;
int i;
char k;
int x;
char state[256];
gate = 0;
res = 0;
k = 0;
x = 0;
for (i = 0; i < 256; i++)
state[i] = GenerateRandomNumber() % 16;
if (inlet_active > 0) {
if ((inlet_trig > 0) && !gate) {
k = k ^ state[x] ^ state[k];
state[x] = k;
if (x == 255)
x = 0;
x++;
gate = 1;
}
else if (!(inlet_trig > 0))
gate = 0;
outlet_out = k * (1 << 23);
}
else {
outlet_out = 0;
}
if ((inlet_rst > 0) && !res) {
k = 0;
x = 0;
res = 1;
for (i = 0; i < 256; i++)
state[i] = GenerateRandomNumber() % 16;
}
else if (!(inlet_rst > 0))
res = 0;