Forum Discussion
yash_verma
5 years agoNew Contributor
Yes i can do that but it wont be a 128 bit guid if i add date. Anyother option u would like to propose.
- ptaylor5 years agoEmployee
No. I’d just use a randomUUID. You’re extremely unlikely to get repeats. We use them all the time when we need unique values and I’m not aware of any issues related to repeats.
- ptaylor5 years agoEmployee
Actually, how about this?
(Date.now().getTime() + Math.randomUUID()).substr(0,36)
That will give you a value like 16008933027615cf16319-1480-4260-9c84. The time component changes every millisecond, plus a random component, and it’s the length you want.