|
|
|
|
|
by ThJ
2441 days 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. |
|
That's exactly how I described this trick in code-comments.