mirror of
https://github.com/reactos/reactos.git
synced 2024-07-07 21:25:05 +00:00
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. svn path=/trunk/; revision=23799
This commit is contained in:
parent
5a487c19e7
commit
0b5c566337
|
@ -83,16 +83,26 @@ RtlRandom (IN OUT PULONG Seed)
|
|||
}
|
||||
|
||||
/*
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue