"random() % n" is sound only when n is a power of two. The error is hardly relevant in Empire, because random() yields 31 bits, and our n are always much smaller than 2^31. Fix it anyway. Use smallest the 2^m >= n instead of n, and discard numbers exceeding n. Bonus: faster for me even in the worst case n = 2^m+1. Like the recent change to damage(), this changes some of the server's die rolls, only this time the effect is pretty pervasive. Worse, fairland now creates a completely different random map for the same seed. Update expected smoke test results accordingly.
21 lines
295 B
Text
21 lines
295 B
Text
add 1 1 1 p
|
|
newcap 1 57,5
|
|
add 2 2 2 p
|
|
newcap 2 22,26
|
|
add 3 3 3 p
|
|
newcap 3 54,26
|
|
add 4 4 4 p
|
|
newcap 4 52,16
|
|
add 5 5 5 p
|
|
newcap 5 37,31
|
|
add 6 6 6 p
|
|
newcap 6 6,20
|
|
add 7 7 7 p
|
|
newcap 7 21,5
|
|
add 8 8 8 p
|
|
newcap 8 6,30
|
|
add 9 9 9 p
|
|
newcap 9 36,20
|
|
add 10 10 10 p
|
|
newcap 10 36,10
|
|
add 11 visitor visitor v
|