diff options
Diffstat (limited to 'datapath-windows/ovsext/Util.h')
-rw-r--r-- | datapath-windows/ovsext/Util.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h index 4bcde3b23..bcd38ddc0 100644 --- a/datapath-windows/ovsext/Util.h +++ b/datapath-windows/ovsext/Util.h @@ -113,4 +113,31 @@ OvsPerCpuDataInit(); VOID OvsPerCpuDataCleanup(); +static LARGE_INTEGER seed; + +/* + *---------------------------------------------------------------------------- + * SRand -- + * This function sets the starting seed value for the pseudorandom number + * generator. + *---------------------------------------------------------------------------- + */ +static __inline +VOID SRand() +{ + KeQuerySystemTime(&seed); +} + +/* + *---------------------------------------------------------------------------- + * Rand -- + * This function generates a pseudorandom number between 0 to UINT_MAX. + *---------------------------------------------------------------------------- + */ +static __inline +UINT32 Rand() +{ + return seed.LowPart *= 0x8088405 + 1; +} + #endif /* __UTIL_H_ */ |