6 ms·
Small bug; your code has a small bias for right. if (random > 0.5) { direction = 'right'; } 1 is not included in Math.Random, so it should be < 0.5 == lef
by NKCSS 11y ago
Small bug; your code has a small bias for right.
if (random > 0.5) {
direction = 'right';
}
1 is not included in Math.Random, so it should be < 0.5 == left, >= 0.5 == right.