#ifndef _NTRTL_H
_Ret_range_(<=, MAXLONG)
NTSYSAPI
ULONG
NTAPI
RtlRandomEx(
_Inout_ PULONG Seed
);
View code on GitHub// ntifs.h
NTSYSAPI ULONG RtlRandomEx(
[in, out] PULONG Seed
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlRandomEx routine returns a random number that was generated from a given seed value.
Seed [in, out]Unsigned long value from which to generate a random number.
RtlRandomEx returns a random number in the range [0..MAXLONG-1].
RtlRandomEx returns values that are uniformly distributed over the range from zero to the maximum possible LONG value less 1 if it is called repeatedly with the same Seed.
The RtlRandomEx function is an improved version of the RtlRandom function. Compared with the RtlRandom function, RtlRandomEx is twice as fast and produces better random numbers since the period of the random numbers generated is comparatively higher.