MQL Integer Random number generation application example

void test_random(void)
{
   int rnd=00;
   string sb_sequence;
   double point;
   MqlRates         rates_array[];
   
   // get point for symbol
   SymbolInfoDouble(_Symbol,SYMBOL_POINT,point);

   // make 100 random runs
   for(int i=0;i < 100;++i)
   {
      // get 10 bars in the past, with a moving offset 
      // (the order is not importent here)
      if(CopyRates(_Symbol ,PERIOD_CURRENT,i,10,rates_array) > 0)
      {
         // get a random number 0 or 1.
         // 0=OP_BUY,1=OP_SELL
         rnd=random_int(rates_array,point, 2,false);
         if(rnd == OP_BUY)
            sb_sequence += " buy";
         else
            sb_sequence += " sell";
            
      }
   }
   
   // print out sequence to Experts log
   Print(sb_sequence);
}