5 ms·
As far as I can tell, this is basically the 32.32 fixed-point equivalent of Math.floor(N * Math.random()). It reminds me of the sort of tricks I used as a teen
by ThJ 7y ago
As far as I can tell, this is basically the 32.32 fixed-point equivalent of Math.floor(N * Math.random()).
It reminds me of the sort of tricks I used as a teenager back in the 90s to speed up my MS-DOS graphics code.
Another trick: You can perform rounding by adding fixed-point 1/2 before the bit shift.
- nullc 7y ago> As far as I can tell, this is basically the 32.32 fixed-point That's exactly how I described this trick in code-comments.