简体   繁体   中英

Algorithm to Create Unique User Id with Objective C

I am creating an online social app. I need a way to create a lot of random unique ID like userId, chatRoom Id things like that. Not only that, I want to make sure that this algorithm can be created with Java or C#. Should I use NSUUID? everytime you create a new NSUUID it will create a new unique string right? Or is there any easy way I can create one using timeStamp?

You can use UUIDs for that. Java and C# have implementations to generate them. In Java use java.util.UUID.randomUUID(); in C# you can use Guid.NewGuid(); .

Have a look at Hashids .

I believe it has versions for multiple languages and would suit your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM