From c0cbcee4bef0d36c21a670b00444b342b7940ce3 Mon Sep 17 00:00:00 2001 From: Chomp Date: Thu, 23 Jan 2025 20:48:33 +0000 Subject: [PATCH] Fixed issue with `Draw` --- Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs index ea4cdd35..7ca8fe35 100644 --- a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs +++ b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs @@ -172,7 +172,7 @@ public class ProbabilityObjectArray : List where T : ProbabilityObje for (var i = 0; i < count; i++) { var rand = Random.Shared.NextDouble(); - var randomIndex = (int)probCumsum.First((x) => x > rand); + var randomIndex = (int)probCumsum.FindIndex((x) => x > rand); // We cannot put Math.random() directly in the findIndex because then it draws anew for each of its iteration if (replacement || lockList.Contains(totals.keyArray[randomIndex])) {