| | |
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,810
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 based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings struct temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






