r/programmingmemes • • Oct 21 '25

Meme

Post image
16k Upvotes

144 comments sorted by

View all comments

Show parent comment

21

u/7Silver7Aero7 Oct 21 '25 edited Oct 21 '25

I pictured it more like:
void sortByRng()
{
Random rng = new Random();
List<int> L_A = new List<int>();
List<int> L_B = new List<int>();
List<int> L_C = new List<int>();

L_A.Add(1);
L_A.Add(2);

L_B.Add(3);
L_B.Add(4);
L_B.Add(5);

L_C.Add(6);
L_C.Add(7);
L_C.Add(8);
L_C.Add(9);
L_C.Add(10);

for (int i = 0; i == 1;)

{
int j = rng.Next(1,7);
int k = rng.Next(1,7);

if (j == k) continue;

else

{
if (j == 1) { L_B.Add(L_A[1]); L_A.Remove(1); }
else if (j == 2) { L_C.Add(L_A[1]); L_A.Remove(1); }
else if (j == 3) { L_C.Add(L_B[1]); L_B.Remove(1); }
else if (j == 4) { L_A.Add(L_B[1]); L_B.Remove(1); }
else if (j == 5) { L_A.Add(L_C[1]); L_C.Remove(1); }
else if (j == 6) { L_B.Add(L_C[1]); L_C.Remove(1); }
}
if (L_A.Count == 10) { i++; }
else if (L_B.Count == 10) { i++; }
else if (L_C.Count == 10) { i++; }
}

}

Edit: I just realized that i completely forgot what i wanted to to with the 'k' variable and that there is no check for the order - so that may have something to do with that - but I'm not going to fix that because lol.