Generating a unique ID

String(new Date().time/1000000000).split(".")[1]+"_"+Math.round(Math.random()*999);

Do you think this is ok? I never want to generate the same ID twice, and I cant pull the mac address easily in all environments.

I am thinking this would only generate the same ID if 2 users generated at the same millisecond in time, and the math.random call created the same number. Is my logic correct?

…although, that is still very possible to happen but unlikely for my use case.

(/1000000000) is just to make the ID shorter