jeudi 2 août 2018

Behaviour of casting random to a string

Why are the results different? It seems i cannot cast the returned long of random, what happens here exactly?

This generates a random number every time I restart my arduino program.

randomSeed(analogRead(1)); 
int randomSerial = random(1000,9999);
serialRan = String(randomSerial);

This outputs the same random number every time I restart my arduino program.

randomSeed(analogRead(1));
serialRan = String(random(1000,9999));




Aucun commentaire:

Enregistrer un commentaire