I am going to implement a distributed application with multiple mobile clients and a web based server application. So each client and also the server are allowed to generate
Let me see if I get this straight: you need a 32 bit number that's unique to the device? Ok:
If you hash the nanotime, it is so practically impossible (not totally impossible, collision resistance isn't collision proof) to get the same number. Given the rest of your string, that would make it totally unique. This method doesn't require interactions with the server until it actually needs to use the server. Say the client isn't connected at first start: generate the number, save it, and when it does connect, before anything else happens, check to see if the device exists. If it does, start from scratch. That way you can get a truly unique device ID.