Created
October 27, 2020 16:07
-
-
Save barokurniawan/13a75b11007de846b715b17a159a7eb6 to your computer and use it in GitHub Desktop.
uniqid.js just like uniqid in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uniqid(a = "",b = false){ | |
var c = Date.now()/1000; | |
var d = c.toString(16).split(".").join(""); | |
while(d.length < 14){ | |
d += "0"; | |
} | |
var e = ""; | |
if(b){ | |
e = "."; | |
var f = Math.round(Math.random()*100000000); | |
e += f; | |
} | |
return a + d + e; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment