// using Date new Date().getTime().toString().substring(9,13) // using Random Math.ceil(Math.random()*100) // Note: add more 0s in 100 if you want to make it even more unique.