2 ms·
Also, if we ignore for a moment how hacky it is to implement throttling like this - why would someone write if(!((_ok) ? true : (Math.random() > 0.1))) wh
by m12k 13y ago
Also, if we ignore for a moment how hacky it is to implement throttling like this - why would someone write
if(!((_ok) ? true : (Math.random() > 0.1)))
when you could use
if(!(_ok || Math.random() > 0.1))
or just
if(!_ok && Math.random() < 0.1)
?
- aquarion 13y agoBecause Math.random's expensive and you don't want to execute it unless you're sure.