random number at random time

i am in way to creating guessing number game with lcd. so i want to generate random number so i have function called random() but every time i reset the sequence i being generated i want random sequence every time i reset the board.is there a function or any way to do that

but every time i reset the sequence i being generated i want random sequence every time i reset the board.is there a function or any way to do that

The randomSeed() function changes where in the sequence the random numbers repeat. The problem is getting a good value to pass to the randomSeed() function. On a PC with a clock, you can use time as a seed value. The Arduino doesn't have a clock.

Some people use the value read from a disconnected analog pin, but that isn't all that random, so the value makes a poor seed value.

Here's an article on a noise generator you could use for a source of randomness: http://www.edn.com/design/analog/4420926/White-noise-source-flat-from-1Hz-to-100kHz

you can also ask the user to press the start button a number of times (5) and use the intervals between it in micros() ) to generate a seed. Although this is not totally random at least it will be hard to replicate twice.

// code not tested.

uint32_t seed = 0x1357FDB9;  // you might get it from EEPROM instead
for (int i=0; i< 5; i++)
{
  while (digitalRead(STARTPIN, HIGH);
  uint32_t  t0= micros();
  while (digitalRead(STARTPIN, LOW);
  seed += ( ( micros() - t0 )>> 2);   // this can be more elaborated
}
// store the seed in EEPROM for next run;