diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index d96c0371ec7f8e..86e839d6010e92 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -177,7 +177,7 @@ _random_Random_random_impl(RandomObject *self) /*[clinic end generated code: output=117ff99ee53d755c input=afb2a59cbbb00349]*/ { uint32_t a=genrand_uint32(self)>>5, b=genrand_uint32(self)>>6; - return PyFloat_FromDouble((a*67108864.0+b)*(1.0/9007199254740992.0)); + return PyFloat_FromDouble(((((uint64_t)(a)<<26)|b)|1)*(1.0/9007199254740992.0)); } /* initializes mt[N] with a seed */