X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=common%2Fos.hpp;h=741d345bf18b30d1c702a1770db3e245f7276611;hb=c037ae2b4f749aed15ede635a6b517534bc5a901;hp=985ff6b9ccb84e8a291941017f76f4f9f7c873dc;hpb=e427adb8bab3dad6af1667febf9ed474cb011692;p=apitrace diff --git a/common/os.hpp b/common/os.hpp index 985ff6b..741d345 100644 --- a/common/os.hpp +++ b/common/os.hpp @@ -84,6 +84,18 @@ void abort(void); void setExceptionCallback(void (*callback)(void)); void resetExceptionCallback(void); +/** + * Returns a pseudo-random integer in the range 0 to RAND_MAX. + */ +static inline int +random(void) { +#ifdef _WIN32 + return ::rand(); +#else + return ::random(); +#endif +} + } /* namespace os */ #endif /* _OS_HPP_ */