[Development] CSPRNG vs DPRNG

Thiago Macieira thiago.macieira at intel.com
Thu Oct 12 23:37:44 CEST 2017


On Thursday, 12 October 2017 10:58:25 PDT Thiago Macieira wrote:
> Oops, if I mask off then I need to change the number I'm dividing by. New
> implementation:
> 
> static double generateDouble()
> {
>     // use generate64() to get enough bits
>     quint64 x = generate64();
>     quint64 limit = Q_UINT64_C(1) << std::numeric_limits<double>::digits;
>     x >>= std::numeric_limits<quint64>::digits -
> std::numeric_limits<double>::digits;
>     return double(x) / double(limit);
> }

And I've found bugs in the LLVM and MSVC implementations, and something I'm 
not sure is a bug in those and GCC.

https://codereview.qt-project.org/208317

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list