Algorithm for generating a unique ID in C++?

前端 未结 6 1446
走了就别回头了
走了就别回头了 2021-02-02 07:50

What can be the best algorithm to generate a unique id in C++? The length ID should be a 32 bit unsigned integer.

6条回答
  •  故里飘歌
    2021-02-02 08:08

    You can see this. (Complete answer, I think, is on Stack Overflow.)
    Some note for unique id in C++ in Linux in this site. And you can use uuid in Linux, see this man page and sample for this.

    If you use windows and need windows APIs, see this MSDN page.

    This Wikipedia page is also useful: http://en.wikipedia.org/wiki/Universally_Unique_Identifier.

提交回复
热议问题