From b564d5cc67f265725f2dcec5b321a75c7a1d68de Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 17 Nov 2026 21:48:13 +0100 Subject: [PATCH] Performance tweaks --- Atomorph.NET/AtomorphThread.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Atomorph.NET/AtomorphThread.cs b/Atomorph.NET/AtomorphThread.cs index 42a0d58..3576a44 100644 --- a/Atomorph.NET/AtomorphThread.cs +++ b/Atomorph.NET/AtomorphThread.cs @@ -545,9 +545,18 @@ public class AtomorphThread : IDisposable for (ulong i = 0; i < repeat; ++i) { ulong x1 = random.GenerateNext((uint)(width - 1)); - ulong x2 = random.GenerateNext((uint)(width - 2)); - if (x2 >= x1) - x2++; + + uint x2; + if (width == 2) + { + x2 = (x1 == 0 ? 1u : 0u); // Only two columns, swap them. + } + else + { + x2 = random.GenerateNext((uint)(width - 2)); + if (x2 >= x1) + x2++; + } var x1Row = map[x1]; var x2Row = map[x2];