Not sure where to post this, hopefully someone with contact to the developers can pass this information along.
Since this is happening in multiple places in the bannerlord code base and will lead to unexpected behavior for mods but also for the TW devs itself.
Please find a single example below with an explanation of the error:
If you look at the above code you might think, that looks quite correct but it's not.
Since the underlying random number generator will return a number in the interval [0, 1)
For example if you wanted to disable Maternal mortality, you would assume that a probability of 0 would actually mean that this event can never happen.
But because of the way they check that probability there will still be a chance that this event can happen (rng includes 0 in distribution)
This will lead to unexpected behavior for the player / modder and funny bug reports
For example assuming you would want to disable Maternal mortability, you would actually need to set the propability below 0
Which sucks for the mod UI and player, since they will assume 0 means 0
Since this is happening in multiple places in the bannerlord code base and will lead to unexpected behavior for mods but also for the TW devs itself.
Please find a single example below with an explanation of the error:
C#:
bool isOffspringFemale = (double) MBRandom.RandomFloat <= (double) pregnancyModel.DeliveringFemaleOffspringProbability;
If you look at the above code you might think, that looks quite correct but it's not.
Since the underlying random number generator will return a number in the interval [0, 1)
C#:
/// <summary>Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.</summary>
MBRandom.RandomFloat
For example if you wanted to disable Maternal mortality, you would assume that a probability of 0 would actually mean that this event can never happen.
But because of the way they check that probability there will still be a chance that this event can happen (rng includes 0 in distribution)
This will lead to unexpected behavior for the player / modder and funny bug reports
For example assuming you would want to disable Maternal mortability, you would actually need to set the propability below 0
Which sucks for the mod UI and player, since they will assume 0 means 0
C#:
bool killMother = MBRandom.RandomFloat <= pregnancyModel.MaternalMortalityProbabilityInLabor