[Freeciv-Dev] (PR#2476) myrand does the wrong thing
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I was testing what happens on very small maps, and I found that the
system broke consistently with a ysize less than 18. A bit of gdb, and
the problem is that myrand is being called with a value of zero, which
returns a random number between zero and MAX_UINT32. If we're looking
for a very small random number, getting a very large random number will
produce problems.
This patch makes myrand(size) return zero immediately if its argument is
less than or equal to 1. Additionally, it fixes the only place where
myrand(0) is explicitely called (in client initialization), so now it
calls myrand(MAX_UINT32). If you want a random number between zero and
MAX_UINT32, why not ask for one?
myrand.diff
Description: myrand.diff
- [Freeciv-Dev] (PR#2476) myrand does the wrong thing,
Guest via RT <=
|
|