It is a bit hard to describe what a i want so i start with and example:
Index ArrayPos
1 0,0
2 1,0
3 0,1
4 1,1
5 2,0
6 2,1
7 2,2
8 0,2
9 1,2
10 1,2
11 3,0
12 3,1
and so on. Basically i want to fill the array not row by row or column by column but always the closest free place to 0,0 .
Would be great if duration of the algo would always be the same no matter wether if i want to get the array position for index 3 or 4237882348.
I tried some stuff with modulo but never got it.
If you don’t care about the order of x, y and y, x, then this should work for you:
With this, though 4,4 comes before 5,0, so it depends on the order you want when getting into the larger numbers you don’t have in your example…