lemon/random.h
branch1.0
changeset 369 65f80c81d41c
parent 340 c4aa9f097ef1
child 374 afd134142111
equal deleted inserted replaced
17:95cf46ca15fa 18:4395e2388ccf
    75 #include <sys/time.h>
    75 #include <sys/time.h>
    76 #include <ctime>
    76 #include <ctime>
    77 #include <sys/types.h>
    77 #include <sys/types.h>
    78 #include <unistd.h>
    78 #include <unistd.h>
    79 #else
    79 #else
    80 #include <windows.h>
    80 #include <lemon/bits/windows.h>
    81 #endif
    81 #endif
    82 
    82 
    83 ///\ingroup misc
    83 ///\ingroup misc
    84 ///\file
    84 ///\file
    85 ///\brief Mersenne Twister random number generator
    85 ///\brief Mersenne Twister random number generator
   664 #ifndef WIN32
   664 #ifndef WIN32
   665       timeval tv;
   665       timeval tv;
   666       gettimeofday(&tv, 0);
   666       gettimeofday(&tv, 0);
   667       seed(getpid() + tv.tv_sec + tv.tv_usec);
   667       seed(getpid() + tv.tv_sec + tv.tv_usec);
   668 #else
   668 #else
   669       FILETIME time;
   669       seed(bits::getWinRndSeed());
   670       GetSystemTimeAsFileTime(&time);
       
   671       seed(GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime);
       
   672 #endif
   670 #endif
   673       return true;
   671       return true;
   674     }
   672     }
   675 
   673 
   676     /// @}
   674     /// @}