Generate random message id.

About message ID, [the CoAP](https://datatracker.ietf.org/doc/draft-ietf-core-coap/?include_text=1) specification say  : 

_"**4.4.  Message Correlation** ...
... Several implementation strategies can be employed for generating Message IDs. ... ...  It is strongly recommended that the initial value of the variable (e.g., on startup) be randomized, in order to make successful off-path attacks on the protocol less likely."_

So, I propose to replace the predictible way to generate message ID by using `srand()` and `rand()` from `stdlib`.