What error?
The random fill just fills a memory area with zeroes when using a non-ESP board. Else it fills with random numbers.
I do not know too much about about encryption but filling with zeroes results in a predictable encryption which is considered undesired.
Depending on how strong your random number generator needs to be it can be reasonably easy to modify that function; just call random() form RNG::get().
byte RNG::get()
{
#if defined ESP32
// ESP32 only
uint32_t* randReg = (uint32_t*) 0x3FF75144;
return (byte) *randReg;
#elif defined ESP8266
// ESP8266 only
uint32_t* randReg = (uint32_t*) 0x3FF20E44L;
return (byte) *randReg;
#else
// NOT SUPPORTED
// sterretje 20251016
return random();
#endif
}
Now that is still not too random; you might want to seed the random number generator with some unpredictable number. If your application uses user input you can use the first time that something happened (e.g. serial received, button pressed) and store that in EEPROM (not sure what the Uno R4 WiFi exactly has, it might be simulated EEPROM). That saved time can be used the next time that want to seed the random number generator.
And there is this topic on the forum: The reliable but not very sexy way to seed random (latest code in post #53). You will need to hack it a bit because it was written for boards with an AVR procssor (including avr/eeprom.h), not a Renesas.
You need an application in Azure that can do the decryption and just like you have SHA256 keys in your Arduino you will have the same SHA256 keys in the Azure application.
But this does not have anything to do with certificates. The certificates are used for the encryption of the communication (e.g. https).
I have no idea how an Uno R4 WiFi works when it comes to network / WiFi communication. Maybe https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples/ shines some light on it for you.