g++ & rand() in Cygwin

Gerrit P. Haase gp@familiehaase.de
Sun Mar 20 19:02:00 GMT 2005


Alex Vinokur wrote:
> ------ foo.cpp ------
> #include <cstdlib>
> #include <iostream>
> using namespace std;
> int main ()
> {
>   cout << rand() << endl;
>   cout << rand() << endl;
>   return 0;
> }
> ---------------------
> 
> 
> // g++ version 3.3.3 (cygwin special)
> 
> $ g++ foo.cpp
> 
> The program below generates the following output:
> -----------
> 0
> 1481765933
> -----------
> 
> First pseuso-random number is 0.
> 
> Is it by purpose?

I don't know.  I use MT for random number generation:

http://anfaenger.de/cygwin/MersenneTwister/


Gerrit
-- 
=^..^=

Action Soccer: http://www.action-soccer.de/?lv=de&id=505
(german online game)



More information about the Gcc-help mailing list