Closed rdebath closed 2 years ago
Whoever wrote train physics originally forgot that 10
was exclusive not inclusive, which caused the gradual bias
Okaay. Inclusive lower, exclusive upper. You'll notice I have the same issue, but because I chose a larger range (to use the higher bit) it doesn't impact so much.
For consistency with elsewhere I went with rand.Next(1, 100+1)
fun fact: deleting fireworks handler probably also has the same mistake
Make a 256xNx256 map Place a checkered layer of red and white blocks. Place 2000-3000 train blocks above these. Run for a while, the train blocks should spread out evenly across the map, however, instead they display a marked preference to move toward the 0,0,0 corner.
This appears to be due to a very poor random number generator as this change fixes the issue...
The change means that bit 9 rather than bit 4(ish) is used as the random source and the modulus is a power of two.