Random Seed Help

I am not very familiar with the random seed function. I need a new output for a randomizer each time, but the random function doesn’t work, so I need a randomSeed function. Could someone explain and also provide an example modified from this code? I DONT KNOW HOW TO USE THE RANDOMSEED FUNCTION PLZ HELP ME.

pos=random(10,180);
myservo.write(pos);
delay(3500);
if(pos < 96) {
myservo.write(10);
}
else {
myservo.write(180);
}

Have you read the documentation?

so I need a randomSeed function

Do you you mean like this one ? randomSeed()

Yes I have read it, i just don't know how to use it

cla_tronix:
Yes I have read it, i just don’t know how to use it

There’s an example right in that link:

long randNumber;

void setup() {
  Serial.begin(9600);
  randomSeed(analogRead(0)); //<<<<<<<<<<<<<<<<<<<<<<<<<
}

void loop() {
  randNumber = random(300);
  Serial.println(randNumber);
  delay(50);
}

I have tried to use the function, but I still dont know how to make it random every time, or connect it to a servo. Also, I need the random number to be within a certain range

Put randomSeed() in setup() as in the example

I need the random number to be within a certain range

See random()

cla_tronix:
but I still dont know how to make it random every time

Well it's really only pseudo-random, but if you let it pick up some atmospherics from an unconnected analog pin, you get some degree of randomness.

cla_tronix:
or connect it to a servo.

No idea what that means.

UKHeliBob:
Put randomSeed() in setup() as in the example
See random()

I need it to be in a certain range, but still be random every time. I have already put the example in my command, and I still do not get a different result every time, unless I use a potentiometer, but that only alters the results slightly.

Why didn't you open with that, save messing around linking to stuff you already know.

What I do sometimes is use millis() in the seed. Halt the sketch in setup() until I press a button to release it, and use millis() at that instant. So I could start the sketch, go and make tea, come back and hit the button.

If you have user input, you can use that too. Stop with a question or message, "what is your name?" or "welcome to the game... press any key to play" and then capture the millis() time of the response. There is the seed value.