| | |
How to generate an uniqe number always?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
C++ Syntax (Toggle Plain Text)
int getUnique() { static int n = 0; return ++n; }
This function is not multithreading safe.
All my posts may be redistributed under the GNU Free Documentation License.
•
•
Join Date: Oct 2008
Posts: 35
Reputation:
Solved Threads: 1
C++ Syntax (Toggle Plain Text)
Console.WriteLine(System.Guid.NewGuid().ToString());
•
•
Join Date: Jan 2008
Posts: 3,813
Reputation:
Solved Threads: 501
http://msdn.microsoft.com/en-us/libr...stem.guid.aspx
How low of a probability are you looking for?
•
•
•
•
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Help with C++
- Next Thread: ifstream and eof
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






