Y
Hacker News
new
|
ask
|
show
|
jobs
by
legosexmagic
1252 days ago
you can use (abuse?) multiplication to get a nice dither without any tables:
bool dither(int time, int value) { time *= value; return (value + time ^ value ^ time) < 0; }
where value is in the range 0 ... (int_max/2)