Cannot store random() to a variable

I’m new to Arduino, and I’m trying to store the value from random() into a long variable, but i get an error when trying to do so.

long rand;
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(2, INPUT);
  Serial.begin(9600);
}

void loop()
{
  if(digitalRead(2)==1)
  {
  for(int k = 0; k < 4; k++)
  {
    while(digitalRead(2) == 1)
    {
      rand = random(9,14);
   digitalWrite(rand, HIGH);// sets a random LED on
      
  delay(random(100,300));              // wait for some time (between 0.1 and 3 seconds)
  digitalWrite(rand, LOW);    // sets a random LED off
  delay(random(10,300)); // wait for some time (between 0.1 and 3 seconds)
  }
  }
  }
  while(0);
}

The error i get is:

1:6: error: ‘long int rand’ redeclared as different kind of symbol
23:0,
1:
372:12: error: previous declaration of ‘int rand()’

In function ‘void loop()’:
21:12: error: assignment of function ‘int rand()’
21:12: error: cannot convert ‘long int’ to ‘int()’ in assignment
22:27: error: invalid conversion from ‘int (*)()’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
1:0:
126:6: error: initializing argument 1 of ‘void digitalWrite(uint8_t, uint8_t)’ [-fpermissive]

25:25: error: invalid conversion from ‘int (*)()’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
1:0:
126:6: error: initializing argument 1 of ‘void digitalWrite(uint8_t, uint8_t)’ [-fpermissive]

It looks like rand() is a predefined function, at least according to the C++ Reference.
Try renaming your variable

delay(random(100,300));              // wait for some time (between 0.1 and 3 seconds)
  digitalWrite(rand, LOW);    // sets a random LED off
  delay(random(10,300)); // wait for some time (between 0.1 and 3 seconds)

One of these is not like the other.

I think the second random() parameter needs to be 3000, not 300.