C
cylin
Dear all,
I try to use rand() to generate some integers;
but these integers are never larger than 40000.
I use Borland C++ Builder to test, the result is also same.
But I use g++ in CYGWIN, the result is perfect.
What's wrong?
Here is my test code.
-------------------------------------------
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
int count=0;
for(; {
int value=rand();
if (value>40000) {
cout << value << endl;
if (count++ >10) {
break;
}
}
}
return 0;
}
-----------------------------------------
I try to use rand() to generate some integers;
but these integers are never larger than 40000.
I use Borland C++ Builder to test, the result is also same.
But I use g++ in CYGWIN, the result is perfect.
What's wrong?
Here is my test code.
-------------------------------------------
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
int count=0;
for(; {
int value=rand();
if (value>40000) {
cout << value << endl;
if (count++ >10) {
break;
}
}
}
return 0;
}
-----------------------------------------