// generate random number in uniform distribution [0,1] fun float uniform() { return Std.rand2f(0,1); } // generate a random number in exponentail distribution fun float expo( float alpha ) { return -Math.log(1-uniform()) / alpha; } // synthesis Impulse i => LPF lpf => dac; 8000 => lpf.freq; 2 => lpf.Q; 1 => lpf.gain; // number of expected events per second 10 => float N; // counter 0 => int count; // how long 10::second => dur T; now + T => time later; while( now < later ) { 1 => i.next; count++; expo( N )::second => now; } <<< "expected:", T/second * N, "actual:", count >>>;