id generation in Credit Management

Hello,

I am working on better credit management. For this, I am adding id property to each credit object better better access. So how to generate unique id for each credit object. Either I can use a good hash-function or use automatic generated id feature of javascript.

Is there any other way, of how to do this.

Thanks