Multiply two arrays in a randomly order [closed]

You first want to loop the length of your first array. Then. you want to generate a random number between 0 and the the length of your second array minus one.

Since an array starts with an index of 0, your second array’s last index is 2.

Then, you want to multiply the value of every iteration with the random number. It should look like something like this:

Assuming your third array which is the same size of the first one is called “z”

z[i] = x[i] * y[randomNumber];

Leave a Comment