I'm trying to create a random product ID for a project I'm developing. I'm just looking to create some random hex values. However, I noticed that when I used %x with rand(), it generated 8 digit hex values when I know the maximum value of rand() is 32767.
I have a code snippet...am I doing anything wrong?
Code:srand(time(NULL)); _tcscpy(ProductID, _T("{%8X-%4X-%4X-%4X-%12X}", rand(), rand(), rand(), rand(), rand())); _tprintf(ProductID); Output: {2102E416-3388587B-1C7A6E8-7FFDD000- CCCCCCCC}



LinkBack URL
About LinkBacks





CornedBee