random() always giving the same result, used randomseed()

hi i am trying to generate a random number in the ftp code, but it alwaysgives the same 26807 result i used randomseed(analogRead(A0)), in setup and in the loop, no changes

please help here is the part of my code

void setup()
{ 
  Serial.begin(9600);
  
randomSeed(analogRead(A0));
  digitalWrite(10,HIGH);

  if(SD.begin(4) == 0)
  {
    Serial.println(F("SD init fail"));          
  }

  Ethernet.begin(mac, ip); 
  digitalWrite(10,HIGH);
  delay(2000);
  Serial.println(F("Ready. Press f or r"));
}

void loop()
{
  byte inChar;
randomSeed(analogRead(A0));
  inChar = Serial.read();

  if(inChar == 'f')
  {randomSeed(analogRead(A0));
    if(doFTP()) Serial.println(F("FTP OK"));
    else Serial.println(F("FTP FAIL"));
  }

  if(inChar == 'r')
  {
    readSD();    
  }

}

File fh;

long rand=random(10000,999999);
Serial.printlt(rand);

the result is always 26807

What is the code supposed to do?

Call randomseed only once but call random every time you want a new number... here it seems you generate only one random number - but unsure as your code is a snippet that won’t compile

Go read the documentation and see the example

long randNumber;

void setup(){
  Serial.begin(115200);
  randomSeed(analogRead(0));
}

void loop() {
  randNumber = random(50,300); // generate  a random number between 50 and 299
  Serial.println(randNumber); 
  delay(1000);
}

Is A0 connected to anything? If so, it's not going to produce a good random seed.

If it is not connected to anything and you want it more random you can attach a piece of wire to A0 but don't connect the other end of the wire to anything!

https://forum.arduino.cc/index.php?topic=66206.msg537783#msg537783 might be of interest.