java. Unique identifier for each visitor. How better generated?
I need to generate a unique identifier (uniqueID
) for each visitor my site. Which algorithm is better use for this? Have any ideas?
Update: small condition: do not u开发者_StackOverflow社区se Session Id.
The easiest would be to store a UUID
in the Session.
How about just using the web container's Session ID?
See HttpSession.getId()
I usually use microsec time, but if two users somehow get on at the exact same time i add a random number to the end of it. (still a possibility for repeats, but very unlikely)
精彩评论