I got this program which I have pasted below is not behavouring as I would expect it to.

It works fine but the thing is that it is not displaying the random numbers in the range i want it to, which is 1000-1112.

When I run it I find that the numbers are outside of this range!
I have no idea why?????????

Could someone help me out
Many thanks



#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <time.h>

int main()
{
srand( time(0));

for ( int i = 1; i <= 20; i++ ) {
cout << setw( 10 ) << ( 1000 + rand() % 1112 );

if ( i % 5 == 0 )
cout << endl;
}

return 0;
}