how to add random choosen numbers

Hi, I'm absolutely new to Arduino. I'm using an Arduino One board to drive a stepper motor. The project has to end in an useful watch winder. I want the winder to turn clock wise and counter clock wise with a break in between. This all by selected random numbers.

My succes so far is to have the motor spinning clock wise and counter clockwise, pause in between all by random.
As i want to read on a lcd I also have managed to display the turns in numbers and the breaks in seconds.

As cherry on the pie I want to add the total of the rotations and show the in the bottom line of the lcd. But here is my problem. I just cant make the random numbers to add.

I tried a for loop, but cant figure out what the upper limit is and the numbers just wont add.

Please see my code i (appologise for the coding. It isd my first serious atempt) - but it works for what i wanted so far.

/*
Allegro A3967 based EasyStepper board
*/
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
//I2C pins declaration
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 

int dirPin = 2;
int stepperPin = 3;
int smEnablePin = 7;
long randnummer;
long randnummerccw;
long kies;
int stop;
int stopccw;
float rot;
float rotccw;
int sec;
int secccw;
int mC;

void setup() {

  lcd.begin(16,2);//Defining 16 columns and 2 rows of lcd display
  lcd.backlight();//To Power ON the back light
  //lcd.backlight();// To Power OFF the back light
  
  pinMode(dirPin, OUTPUT);
  pinMode(stepperPin, OUTPUT);
  pinMode(smEnablePin, OUTPUT);
  
  Serial.begin(9600);
  randomSeed(analogRead(0));
  
}

void step(boolean dir,int steps){
  
  digitalWrite(dirPin,dir);
  delay(50);
  for(int i=0;i<steps;i++){
    digitalWrite(stepperPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin, LOW);
    delayMicroseconds(1000);
  }
  mC=0;
}

void loop(){
  //randnummer = 0;
  //randnummerccw = 0;
  //mC=0;
  
  kies = random(1,10000);
  Serial.println((String)"kies waarde:" +kies);
  if (kies >= 5000){
    
  randnummer = random(0, 5);
  rot = randnummer * 1600;
  lcd.setCursor(0,0); //Defining positon to write from first row,first column .
  lcd.print("cw rotatie: ");
  lcd.print (randnummer);
  //lcd.print((String)"cw rotatie: " +rot);
  //lcd.print((String)"cw steps: " + randnummer);
  //Serial.println((String)"cw steps:" +randnummer);  
  step(true,rot);
  //if(random > 0){
  //lcd.setCursor(6,1);
  //lcd.print(random);
  //delay (1000);
  //random --;}
  //lcd.clear();//Clean the screen
   mC = mC+randnummer;
      lcd.setCursor(0,1);
      lcd.print(mC);
      

  stop = random(0, 5);   
  lcd.setCursor(0,0);  //Defining positon to write from second row,first column .
  sec = stop;  
  lcd.print((String)"Wacht "+sec);
  lcd.print (" sec      ");
  //Serial.println((String)"Ms stop:" + stop);
  digitalWrite (smEnablePin, HIGH);
  delay(stop * 1000);
  digitalWrite (smEnablePin, LOW);
  
  //lcd.clear();//Clean the screen
  }
  else
  {
  randnummerccw = random(0, 8);
  rotccw = randnummerccw * 1600;
  lcd.setCursor(0,0); //Defining positon to write from first row,first column .
  lcd.print((String)"ccw rotatie: " +randnummerccw);
  //lcd.print((String)"cw steps: " + randnummerccw);
  //Serial.println((String)"ccw steps:" +randnummerccw);
  step(false,rotccw);
  //lcd.clear();//Clean the screen

  stopccw = random(500, 10000);   
  lcd.setCursor(0,0);  //Defining positon to write from second row,first column .
  secccw = stopccw / 1000;
  lcd.print((String)"Wacht "+secccw);
  lcd.print (" sec     ");
  //Serial.println((String)"Ms stop:" + stop);
  digitalWrite (smEnablePin, HIGH);
  delay(stopccw);
  digitalWrite (smEnablePin, LOW);
  //delay(500);
  //lcd.clear();//Clean the screen
  }
      
      
    
  
}

Thanks for using code tags!

Please define what you mean by the following, and post examples. Math does work properly on the Arduino, as long as you understand the limitations of variable sizes and types.

I just cant make the random numbers to add.

Try this:

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
int a=random(1,1000);
int b=random(1,1000);
Serial.print(" a = ");
Serial.print(a);
Serial.print(" b = ");
Serial.print(b);
Serial.print(" a+b = ");
Serial.println(a+b);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Welcome,

Maybe remove "mC=0;" in your step() function ?

Thank u guys for replaying.

I just cant make the random numbers to add.

Because the random nubers are in a loop every time the loop genarates a new random number.

in the clock wise loop, loop1 genarates random1, in loop2 the result is random2, etc.

This also counts for the counter clock wise loop.
loop 1 generates randomccw1, loop 2 generates randomccw2, etc.

As a result i want to add all the resulst so
sum=random1 + random2 + randometc + randomccw1 + randomccw2 + randomccwetc

hope this example clears it out.