From 8840785a74f57cf1e4c59e46b8f309c4c2cef04c Mon Sep 17 00:00:00 2001 From: basuhei Date: Thu, 26 Feb 2026 17:13:48 +0900 Subject: [PATCH] Fix totalWeight not being reset in Clear --- src/NRandom/Collections/WeightedList.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/NRandom/Collections/WeightedList.cs b/src/NRandom/Collections/WeightedList.cs index b9d3ba3..269e5c6 100644 --- a/src/NRandom/Collections/WeightedList.cs +++ b/src/NRandom/Collections/WeightedList.cs @@ -107,6 +107,7 @@ public void Add(T value, double weight) public void Clear() { list.Clear(); + totalWeight = 0.0; } public bool Contains(WeightedValue item)