mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Fixed GetRandomWeightedEntry distribution not being equal for equal weights
This commit is contained in:
parent
230f2e954c
commit
e09484cbe7
2 changed files with 3 additions and 2 deletions
|
@ -28,6 +28,7 @@ Fixes
|
||||||
- Fixed TextInputs behaving incorrectly when switching between multiline and single-line modes
|
- Fixed TextInputs behaving incorrectly when switching between multiline and single-line modes
|
||||||
- Fixed TextInput drawing characters with the wrong width if a masking character is used
|
- Fixed TextInput drawing characters with the wrong width if a masking character is used
|
||||||
- Fixed a multiline TextInput's cursor not returning to the default position when the last character is removed
|
- Fixed a multiline TextInput's cursor not returning to the default position when the last character is removed
|
||||||
|
- Fixed GetRandomWeightedEntry distribution not being equal for equal weights
|
||||||
|
|
||||||
Removals
|
Removals
|
||||||
- Marked GetDownTime, GetUpTime and GetTimeSincePress in Keybind and Combination as obsolete
|
- Marked GetDownTime, GetUpTime and GetTimeSincePress in Keybind and Combination as obsolete
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace MLEM.Extensions {
|
||||||
var currWeight = 0;
|
var currWeight = 0;
|
||||||
foreach (var entry in entries) {
|
foreach (var entry in entries) {
|
||||||
currWeight += weightFunc(entry);
|
currWeight += weightFunc(entry);
|
||||||
if (currWeight >= goalWeight)
|
if (currWeight > goalWeight)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
|
@ -49,7 +49,7 @@ namespace MLEM.Extensions {
|
||||||
var currWeight = 0F;
|
var currWeight = 0F;
|
||||||
foreach (var entry in entries) {
|
foreach (var entry in entries) {
|
||||||
currWeight += weightFunc(entry);
|
currWeight += weightFunc(entry);
|
||||||
if (currWeight >= goalWeight)
|
if (currWeight > goalWeight)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
|
|
Loading…
Reference in a new issue