How to randomize array elements ?

 

i have an array containing 30 elements ?

How to interchange their positions in array randomly  everytime i call a function ?

 

https://www.mql5.com/en/docs/math/mathsrand  and https://www.mql5.com/en/docs/math/mathrand

at init:

MathSrand(GetTickCount());

in the "loop":

int index= MathRand()%30;

so you change the access to the array, not the values at its positions.

Best wishes Uwe

Documentation on MQL5: Math Functions / MathSrand
Documentation on MQL5: Math Functions / MathSrand
  • www.mql5.com
Math Functions / MathSrand - Documentation on MQL5