Reactos

[RTL] Fix random functions

+4 -4
+4 -4
sdk/lib/rtl/random.c
··· 118 118 119 119 PAGED_CODE_RTL(); 120 120 121 - Rand = (*Seed * LCG_A + LCG_C) % LCG_M; 122 - *Seed = (Rand * LCG_A + LCG_C) % LCG_M; 121 + Rand = ((ULONG64)*Seed * LCG_A + LCG_C) % LCG_M; 122 + *Seed = ((ULONG64)Rand * LCG_A + LCG_C) % LCG_M; 123 123 Pos = *Seed & (sizeof(RtlpRandomConstantVector) / sizeof(RtlpRandomConstantVector[0]) - 1); 124 124 Result = RtlpRandomConstantVector[Pos]; 125 125 RtlpRandomConstantVector[Pos] = Rand; ··· 157 157 158 158 Pos = RtlpRandomExAuxVarY & (sizeof(RtlpRandomExConstantVector) / sizeof(RtlpRandomExConstantVector[0]) - 1); 159 159 RtlpRandomExAuxVarY = RtlpRandomExConstantVector[Pos]; 160 - Rand = (*Seed * LCG_A + LCG_C) % LCG_M; 160 + Rand = ((ULONG64)*Seed * LCG_A + LCG_C) % LCG_M; 161 161 RtlpRandomExConstantVector[Pos] = Rand; 162 162 *Seed = Rand; 163 163 ··· 197 197 ULONG Result; 198 198 199 199 /* Generate the random number */ 200 - Result = (*Seed * LCG_A + LCG_C) % LCG_M; 200 + Result = ((ULONG64)*Seed * LCG_A + LCG_C) % LCG_M; 201 201 202 202 /* Return it */ 203 203 *Seed = Result;