how to use time() in g++ for random number generator seed?

eric fsshl@att.net
Fri Jul 22 03:50:00 GMT 2011


Dear Paolo Carlini or any g++ of libstdc++ programers:

  I search to you from gcc's search engine "time()"
  I like to use time() as seed of random function generator
----------
srand(static_cast<unsigned int>(time()));
------------
is in some line of some of my c++ programs
But, my g++ complain
--------
eric@eric-laptop:~/cppcookbook/ch11$ g++ Example11-11.cpp
Example11-11.cpp: In function ‘int main()’:
Example11-11.cpp:14:41: error: too few arguments to function ‘time_t
time(time_t*)’
/usr/include/time.h:186:15: note: declared here
------------
Need your help to fix it and thanks a lot in advance, Eric 



More information about the Libstdc++ mailing list