Random number generator not initialized?

Hi all,

I’m experiencing something weird here. I’m using random(ID_MIN, ID_MAX) to generate a kind of job IDs. From the documentation, I expected to get random numbers, because

On startup, the default random seed is set by the system to 1. Unless the seed is modified, the same sequence of random numbers would be produced each time the system starts. Fortunately, when the device connects to the cloud, it receives a very randomized seed value, which is used as the random seed. So you can be sure the random numbers produced will be different each time your program is run.

Unfortunately, that is not the case at all. I get the same sequence of pseudo-random functions every time I restart my Photon. Am I missing something there?


Could you share the code you’re using?


void setup() {

void loop() {
  int num = random(10000, 99999);
  Particle.publish("random number", String::format("%d", num), 3600, PRIVATE);


I think this is the same as reported in this thread:

@mdma said he would look at it. Perhaps he has some time now to investigate.