What is a "random ss number"? The function rand() returns an integer from 0 to RAND_MAX (which is at least 31768). You have to initialize it with "srand()" first.
To convert this number into a string, you can use std::stringstream.
An example of a simple pseudo-random number generator that is computationally fast, has good (albeit not cryptographically strong) randomness properties, is given by the following "Multiply-With-Carry" generator.
m_w = <choose-initializer>; /* must not be zero */
m_z = <choose-initializer>; /* must not be zero */
what i really want to do is that i am generating randomly social security number but i have to use a sorting method (heap or selection sort). each ssn have to be stored as a string and must be distinct the time complexity is very important