Author: greatlrd Date: Wed Aug 30 14:13:01 2006 New Revision: 23799
URL: http://svn.reactos.org/svn/reactos?rev=23799&view=rev Log: Implement RtlRandomEx by copy RtlRandom code. ms have two different implement, One random is faster that other, (in some doc I read (maybe from osr) some year ago), the RtlRandomEx is not document in the free ddk/sdk, but it is include in ddk/ifs kit, according the doc.
Modified: trunk/reactos/lib/rtl/random.c
Modified: trunk/reactos/lib/rtl/random.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/random.c?rev=23799&... ============================================================================== --- trunk/reactos/lib/rtl/random.c (original) +++ trunk/reactos/lib/rtl/random.c Wed Aug 30 14:13:01 2006 @@ -83,16 +83,26 @@ }
/* -* @unimplemented +* @implemented */ ULONG NTAPI -RtlRandomEx( - PULONG Seed +RtlRandomEx( IN OUT PULONG Seed ) { - UNIMPLEMENTED; - return 0; + ULONG Rand; + int Pos; + ULONG Result; + + PAGED_CODE_RTL(); + + Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; + *Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; + Pos = *Seed & 0x7f; + Result = SavedValue[Pos]; + SavedValue[Pos] = Rand; + + return Result; }