As for calculation speed, it is the same:
for(int a = 0; a<10; a++)
{
var1[a] = random(255);
}
for(int b = 0; b<10; b++)
{
var2[b] = random(255);
}
a:
for(int a = 0; a<10; a++)
{
var1[a] = random(255);
var2[a] = random(255);
}
Because out of ignorance and my common sense, despite being two cycles (therefore, 20 searches in the arrays) in the first case, in the second case the value is changed twice as many variables as in the first.
Thank you very much
If your question is whether the runtime of both functions is the same, the answer is Yes. And is O(n) .
As far as runtime is concerned, it is the same to go through 2 arrays of length n in separate loops ( 2n ), as it is to go through the same 2 arrays, as long as they are not nested, within the same loop.
.