# Ordered execution of an inner loop

Hi There, hope someone can help me with my beginner question.
Problem outline (simplified version):
I want to do something similar to a random walk that is where I do a calculation like this:

``````Array_outer=[100,200,300,400,500,600,700,800,900,1000]; // (has some values which are the starting positions for the inner loop)
Array_inner=[ , , , , , , , , , ]; //(is empty at the start but has a fixed number of elements that need to get filled and passed back to the host)

for(i=0;t<10;i++){ // the order of execution of the outer loop doesn’t matter so I can                      kick off as many of these as possible
for(t=1;t<10;t++){ // this has to be processed in index order from 1 to 10
array_inner[0]=array_outer[i];
array_inner[t] += array_inner[t-1]*RNORM();

}
}
``````

I think GPGPU coding can help me because I want to do this with 10,000 starting values in the outer loop simultaneously for speed. I just cannot figure out how to ensure the inner loop gets processed by index order.
Any suggestions on how to tackle this are greatly appreciated.
Thanks,
Peter

Is the outer loop condition t<10 correct? Should it be i<10?

This loop is executed only one for i=0 becasue of the typo JFSebastian mentioned.