According to the documentation (which you really should read!):
Returns a pseudo-random integral value between 0 and RAND_MAX
RAND_MAX is implementation defined, but is guaranteed to be at least 32767. In fact, it often is 32767, and that appears to apply to you.
The documentation also states:
rand() is not recommended for serious random-number generation needs. It is recommended to use C++11’s random number generation facilities to replace rand().
And that is what I would advise you to do.
But as for getting specific output, that’s another thing. It’s a strange requirement, where is it coming from?
solved C++ generate random numbers for a given seed [closed]