The correct way to write that code fragment would be:
if (Math.random() * 2 >= 1) return;
or:
if (Math.random() >= 0.5) return;
But the worst part is that he realised his cyberwarfare WMD wasn't working properly and deployed it anyway. I would not trust my geofence to keep the malware restricted to Belarus and Russia if I couldn't even figure out how to code a coinflip.
The correct way to write that code fragment would be:
or:
But the worst part is that he realised his cyberwarfare WMD wasn't working properly and deployed it anyway. I would not trust my geofence to keep the malware restricted to Belarus and Russia if I couldn't even figure out how to code a coinflip.