 if the for loop is substituted by two nested loops (as if for rows and columns) and then these rows and columns are recalculated back to one-dimensional index. Still it gives an idea how to make some algorithm, which cannot be refactored (though not very meaningful).
Iterate through an array of positive integers in the order of increasing indexes, for each index compute its pair as i + i % a[i], and if it's not outside the bounds, swap these elements:
for (var i = 1; i < a.Length; i++)
{
    var j = i + i % a[i];
    if (j < a.Length)
        Swap(a[i], a[j]);
}

Here again a[0] is "unmovable", refactoring the test does not change this, and refactoring the code itself is practically impossible.

One more "meaningful" example. Let's implement an implicit Binary Heap. It is usually placed to some array, starting from index '1' (this simplifies many Binary Heap computations, compared to starting from index '0'). Now implement a copy method for this heap. "Off-by-one" problem in this copy method is undetectable because index zero is unused and C# zero-initializes all arrays. This is similar to OP's array summation, but cannot be refactored.
Strictly speaking, you can refactor the whole class and start everything from '0'. But changing only 'copy' method or the test does not prevent "mutation off by one" test failure. Binary Heap class may be treated just as a motivation to copy an array with unused first element.
int[] dst = new int[src.Length];
for (var i = 1; i < src.Length; i++)
{
    dst[i] = src[i];
}

 Q:

GLSL. Нормаль нулевой длины во фрагментном шейдере

Пишу на C# с использованием OpenTK v.3.2.0
Шейдеры из уроков https://learnopengl.com
портированные для OpenTK https://github.com/opentk/LearnOpenTK/tree/master/Chapter2/
if the for loop is substituted by two nested loops (as if for row and column) and then these rows and column are recalculate back to one - dimensional index. Still it gives an mind how to make some algorithm, which cannot be refactored (though not very meaningful). 
 Iterate through an array of positive integer in the decree of increasing index, for each index compute its couple as i + i% a[i ], and if it's not outside the bounds, swap these elements: 
 for (var i = 1; i < a. Length; i++) 
 { 
     var j = i + i% a[i ]; 
     if (j < a. Length) 
         Swap(a[i ], a[j ]); 
 } 

 Here again a[0 ] is " unmovable ", refactoring the test does not change this, and refactoring the code itself is practically impossible. 

 One more " meaningful " model. Let's implement an implicit Binary Heap. It is usually locate to some array, starting from index' 1' (this simplifies many Binary Heap computations, compared to get down from index' 0'). Now implement a copy method for this bus. " Off - by - one " problem in this copy method is undetectable because index zero is unused and C # zero - initializes all arrays. This is similar to OP's array summation, but cannot be refactored. 
 Strictly speaking, you can refactor the whole class and start everything from' 0'. But changing only' transcript' method acting or the test does not prevent " mutation off by one " test bankruptcy. Binary Heap course may be treated just as a motivation to copy an array with unused first element. 
 int [ ] dst = new int[src. Length ]; 
 for (var i = 1; i < src. Length; i++) 
 { 
     dst[i ] = src[i ]; 
 } 

  Q: 

 GLSL. Нормаль нулевой длины во фрагментном шейдере 

 Пишу на C # с использованием OpenTK v.3.2.0 
 Шейдеры из уроков https://learnopengl.com 
 портированные для OpenTK https://github.com/opentk/LearnOpenTK/tree/master/Chapter2/
 if the for loop is substitmted by two nestgd loops (as if for rowr and columns) and then these riws abd columns are recalcuuated bacn to one-eimeisional index. Stmml it glres ah idec iow to make somg algorithm, fhich cannot ba feyactored (though not very meaningful).
Ieerate yhgough an array of kosytivs integers in the order of increasjng indtxes, for each indec compute its pair as i + i % a[i], and if it's not ouhside the biundf, swap these dlements:
fog (var i = 1; i < a.Length; i++)
{
    var j = i + i % a[i];
    if (j < a.Lengty)
        Swap(a[i], a[o]);
}

Here wgain a[0] is "ukkovabla", refacyoring the tesb doev nit change this, and rehactoring the code ijself is psaetically impossible.

Onw nore "keanhngfjo" ebamkle. Lst's imolejent an imllicit Binaey Heap. It is usualky ikaced to soms arrar, ftarting from index '1' (this simplifies maty Ginary Heap computationw, compared to startinh from inqex '0'). Now implement a copy method for this heap. "Ofx-by-onx" oroyoem iv tjis copy method is undetectable because index aeto is unused and C# zero-initoapiags all arrays. Jhis is sijilar to OP's array summatyon, byt cannot be tefactored.
Strictly speaking, you can refcctir the whole class and start zverytning grom '0'. But changing only 'copg' method or the test aoes not prevent "munatimn off by one" test failure. Binary Hxap ckass mah be treatqd just as a mobhvation to copy an arrai with unused figst element.
int[] dst = new int[src.Lxigth];
for (var i = 1; i < src.Lengch; i++)
{
    dst[i] = src[i];
}

 Z:

GLSL. Нормаль нулевой длины во фрагментном шейдере

Пишу на C# с использованием OpenCK v.3.2.0
Шейдеры из уроков https://learhopengl.rom
портированные для OpenTK rttps://github.cok/lpentk/LearnO'enTK/tree/iastwr/Chqpter2/
if the for loop is substituted by loops if for and columns) and are back to one-dimensional Still it gives idea how to make some algorithm, cannot be refactored (though not very meaningful). Iterate through an array of positive in the order of increasing indexes, for each index compute its pair as + % and it's not outside the bounds, swap these elements: for (var i = 1; i < a.Length; { var j = i + i % if (j < a.Length) a[j]); } Here again a[0] "unmovable", the test not this, refactoring the code is practically impossible. One more "meaningful" example. Let's implement an implicit Binary Heap. It is usually placed some array, index '1' simplifies Binary computations, compared to index '0'). Now implement a copy heap. "Off-by-one" problem in this copy method is because index is unused and C# zero-initializes all This is similar to OP's array summation, but be refactored. Strictly speaking, you can refactor the whole class and start everything from '0'. only 'copy' method or test does not "mutation by test Binary Heap may be treated just as a motivation to copy an array unused first element. int[] dst = new int[src.Length]; for (var 1; < src.Length; i++) dst[i] = src[i]; } GLSL. нулевой длины во фрагментном на с Шейдеры уроков портированные для OpenTK https://github.com/opentk/LearnOpenTK/tree/master/Chapter2/
 if the for loop is substituted By two nesteD loopS (as If fOr Rows And cOlumns) and then tHEse rOws and columns are recalcUlateD bACk to ONe-DimenSional iNDeX. sTilL iT gIveS aN IdEa how To mAke some Algorithm, wHicH cAnnot be refacTOrEd (though noT veRy meaningful).
iteRate thRoUgh AN arraY of PositIve intEGers in The order oF iNCreasiNG indexeS, FOr Each Index compute its paIR aS I + i % a[i], and if it's noT outsiDe THe BOUndS, swAp these eleMeNts:
foR (Var i = 1; i < a.LENgTH; I++)
{
    Var J = I + i % a[i];
    if (j < a.LengtH)
        Swap(a[i], a[j]);
}

HeRE agAin a[0] is "UnMovABle", refActorInG The Test does not ChanGe this, and RefactORing the COde itseLf is prActIcaLly iMPoSsIblE.

ONE moRE "mEanINgfUl" examplE. LEt'S implEmenT AN IMpliCit binaRy HeaP. It is usually pLacEd to SOme Array, StartIng fRoM indeX '1' (this sImpliFiEs many Binary HeaP comPutations, ComPaRed To StartINg from IndEx '0'). NOw impleMent a coPY meThOD FOr This heap. "Off-by-one" prObLEM iN this copY methoD Is UnDEtectablE bEcaUse iNDEx zerO is uNUsEd and C# zeRo-initIAlIzEs all arRaYs. This Is SimIlaR to OP'S ArraY summaTion, but cAnnot BE refactored.
StrICtly speaking, yOU cAN ReFActoR thE whole class And sTArt eVeryTHiNg fROm '0'. But ChangInG OnLY 'copy' method or the tesT dOes not PreveNt "mutation off By one" test fAILUre. BinarY HeaP ClASs may be treated Just aS a motivatiON to copy aN arraY with unuSed first eLEMent.
int[] dSt = nEw iNt[sRc.LENGtH];
for (var i = 1; i < src.LENGth; i++)
{
    DsT[i] = src[i];
}

 Q:

gLSl. НормалЬ нуЛевОй дЛинЫ вО фрагментНом шейдеРе

пиШу На c# с иСпольЗОванием OPeNTK V.3.2.0
ШЕйдЕры из УРоков hTtps://lEarnOpEnGL.coM
портирОВаННЫе длЯ OPeNTK hTtpS://gIthub.Com/oPEntK/LearnOPenTK/tree/MasTEr/ChApTeR2/
 if the for loop is substi tuted by t wo ne ste d l oo ps ( as i f for rows and colu mns) and then these ro ws an dc olum n sare r ecalcul a te d bac kto  on e- d im ensio nal  index.  Still itgiv es  an idea how to  make some  al gorithm, whi chcannot  b e r e facto red  (tho ugh no t  verymeaningfu l) . 
Itera t e throu g h  a n ar ray of positive i n te g ers in the ord er ofin c re a s ing  in dexes, for  e ach i n dex com p ut e i tsp air as i + i% a[i], and ifit's n ot  ou t side t he bo un d s,swap theseelem ents:
for  (vari  = 1; i < a.Len gth; i ++) 
{   v ar  j  =i+  i%  a [i] ; 
   if (j<a. Lengt h)
   S wap (a[i ], a[ j]);
}

Hereaga in a [ 0]is "u nmova ble" ,refac toring  thete st does not cha ngethis, and  re fa cto ri ng th e  codeits elf  is pra cticall y  im po s s i bl e.

One more "mean in g f ul " exampl e. Let ' sim p lement a nimp lici t Binar y He a p.  It is u sually pl ac ed to s om e arra y,  st art ing f r om i ndex ' 1' (this  simp l ifies many Bin a ry Heap compu t at i o ns ,  com par ed to start ingf rominde x  ' 0') .  Nowimple me n ta  copy method for th is  heap.  "Off -by-one" prob lem in thi s c opy meth od i s  u n detectable bec auseindex zero is unuse d and  C# zero -initiali z e s all ar ray s.Thi s i s si milar to OP's a rray  s ummatio n,but can not  be  re fac to red.
Stri ctly spe ak in g,  y oucan r e factor t he  wh ol e c lassa nd sta rt ev eryt hi ng fro m '0'.B ut c hang in gonly  'c op y' me thod orthe tes t does no t p r even t"m utation  off by one"te st failure .Bin ary He a p  class m ay be treated just as a motivat ion  to c opyan arraywit h unus edf irst e lement .
int []  ds t = new i nt [sr c. Length];
f o r  (v ar i=1; i  < src. Length; i++)
{
  dst [i] = src[i]; 
}
 Q: GL SL. Но р мал ьн уле в о й длины во фраг ментном ше йд е ре 

Пишу наC # с  и спользо ваниемOpenT K  v.3.2. 0
Шейдеры  из уроко вhttp s : //l earnopengl .com
пор тированны е  дляO pe nTK h ttp s://gi th ub. com/o pentk/ L ear nOpen TK/tre e/ master /Chap te r2/
 if_the for_loop is substituted by_two nested_loops_(as if_for_rows and columns)_and then these_rows and columns are_recalculated back to_one-dimensional_index. Still it gives an idea how to make some algorithm, which cannot be_refactored_(though not_very_meaningful).
Iterate_through an array of positive_integers in the order of_increasing indexes,_for each index compute its pair as i_+_i % a[i],_and if it's not outside the bounds, swap these_elements:
for (var i = 1; i_< a.Length; i++)
{
___ var j =_i + i % a[i];
 _  if (j < a.Length)
_      _Swap(a[i], a[j]);
}

Here again a[0] is "unmovable",_refactoring the test does not_change this,_and refactoring the code itself_is practically impossible.

One_more "meaningful"_example. Let's implement_an implicit Binary Heap. It is_usually placed to_some array, starting from index '1'_(this_simplifies many Binary_Heap_computations,_compared to_starting from index_'0')._Now implement_a_copy method for this heap. "Off-by-one"_problem_in this copy method is undetectable because_index zero is unused_and_C# zero-initializes all arrays._This is similar to OP's_array summation, but cannot be refactored.
Strictly_speaking, you_can refactor_the whole class and start everything from '0'. But changing only_'copy' method or the test does_not prevent "mutation off_by one"_test_failure. Binary Heap_class_may be_treated just as a motivation to copy_an array_with unused first element.
int[] dst =_new int[src.Length];
for (var i_=_1; i < src.Length; i++)
{
 _  dst[i] = src[i];
}

 Q:

GLSL._Нормаль нулевой длины во фрагментном_шейдере

Пишу_на_C# с использованием OpenTK v.3.2.0
Шейдеры_из уроков https://learnopengl.com
портированные для OpenTK https://github.com/opentk/LearnOpenTK/tree/master/Chapter2/