tangled
alpha
login
or
join now
huwcampbell.com
/
reactos
0
fork
atom
Reactos
0
fork
atom
overview
issues
pulls
pipelines
[RTL] Fix random functions
Timo Kreuzer
7 months ago
b8abfb13
5c1c2810
+4
-4
1 changed file
expand all
collapse all
unified
split
sdk
lib
rtl
random.c
+4
-4
sdk/lib/rtl/random.c
···
118
118
119
119
PAGED_CODE_RTL();
120
120
121
121
-
Rand = (*Seed * LCG_A + LCG_C) % LCG_M;
122
122
-
*Seed = (Rand * LCG_A + LCG_C) % LCG_M;
121
121
+
Rand = ((ULONG64)*Seed * LCG_A + LCG_C) % LCG_M;
122
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
160
-
Rand = (*Seed * LCG_A + LCG_C) % LCG_M;
160
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
200
-
Result = (*Seed * LCG_A + LCG_C) % LCG_M;
200
200
+
Result = ((ULONG64)*Seed * LCG_A + LCG_C) % LCG_M;
201
201
202
202
/* Return it */
203
203
*Seed = Result;