ESP32 unsigned long and millis()

Thanks.

Not necessarily. You can set millis() to any value you want, like an hour before rollover.

This is for the UNO and its ilk, but something similar must be possible on the ESP32:

I do hope you are compiling with all warnings enabled. This sounds like you've inadvertently used an uninitialised variable, which can go way beyond just getting a random number.

a7