X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fos.hpp;h=741d345bf18b30d1c702a1770db3e245f7276611;hb=9882c5f08f337ce494e040e01a6f79816f92170e;hp=985ff6b9ccb84e8a291941017f76f4f9f7c873dc;hpb=5d02d76d0cb38020ec113cbde17b1ef9cbe43bd9;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_ */