Re: [Development] CSPRNG vs DPRNG

2017-10-13 Thread Thiago Macieira
On Friday, 13 October 2017 11:15:19 PDT Lars Knoll wrote: > > Well, one of them is deterministic, but only if you know the seed which > > comes from the non-deterministic one. So it's highly unlikely that you'll > > be able to determine its sequence. > > Of course, but they have different characte

Re: [Development] CSPRNG vs DPRNG

2017-10-13 Thread Lars Knoll
> On 13 Oct 2017, at 16:12, Thiago Macieira wrote: > > On Friday, 13 October 2017 01:30:57 PDT Lars Knoll wrote: >> This sounds like a decent option to me. I'm don't quite like system() and >> global() as names yet, as they don't really make it clear that one of them >> is deterministic. Other t

Re: [Development] CSPRNG vs DPRNG

2017-10-13 Thread Thiago Macieira
On Friday, 13 October 2017 01:30:57 PDT Lars Knoll wrote: > This sounds like a decent option to me. I'm don't quite like system() and > global() as names yet, as they don't really make it clear that one of them > is deterministic. Other than that this looks like a good way forward. Well, one of th

Re: [Development] CSPRNG vs DPRNG

2017-10-13 Thread Lars Knoll
> On 12 Oct 2017, at 17:11, Thiago Macieira wrote: > > On quinta-feira, 12 de outubro de 2017 01:28:34 PDT Edward Welbourne wrote: >>> So I created a better option: QPseudoRandomGenerator (name bikeshedding >>> later) >> I should note that "pseudo-random" is in fact a variant on "chaotic", so >>

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Thiago Macieira
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

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Thiago Macieira
On quinta-feira, 12 de outubro de 2017 10:42:53 PDT Thiago Macieira wrote: > Yet my code is not optimal, since it generates a check for the sign bit > because the x86 instruction CVTSI2SD takes a signed integer as input. That's > useless, since the result has only 53 bits of randomness anyway. So a

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Thiago Macieira
On quinta-feira, 12 de outubro de 2017 10:06:05 PDT Thiago Macieira wrote: > The conversion to double via ldexp is what generateDouble() does in the new > class and is optional. Though I will take a look now to see if using ldexp() > produces better code than > > return double(generate64()) / (dou

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Matthew Woehlke
On 2017-10-12 13:06, Thiago Macieira wrote: > libstdc++'s LCG does: > _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x); > return _M_x; > > which is > > _M_x = (__a * _M_x + __c) % __m; ...and yet, for some reason when I tested it, it was *quite* slow. Noticeably slower than MT

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Thiago Macieira
On quinta-feira, 12 de outubro de 2017 09:23:13 PDT Matthew Woehlke wrote: > The last time I found myself in need of a graphic/game quality PRNG, I > tried fiddling with both rand48 (POSIX) and C++11 MT, and ended up using > this instead: > > m_seed = ( ( 19073486328125 * m_seed ) + 1 ) & 0x7

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Matthew Woehlke
On 2017-10-11 12:12, Thiago Macieira wrote: > I created a better option: QPseudoRandomGenerator (name bikeshedding later) > on the flight home from QtCS. It's a simple wrapper around the Mersenne > Twister > provided by the Standard C++ Library The last time I found myself in need of a graphic/

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Thiago Macieira
On quinta-feira, 12 de outubro de 2017 01:28:34 PDT Edward Welbourne wrote: > > So I created a better option: QPseudoRandomGenerator (name bikeshedding > > later) > I should note that "pseudo-random" is in fact a variant on "chaotic", so > perhaps QChaoticGenerator would be more apt. Chaos is not

Re: [Development] CSPRNG vs DPRNG

2017-10-12 Thread Edward Welbourne
Thiago Macieira (11 October 2017 18:12) > I've come to the conclusion that adding QRandomGenerator, a (mostly) > cryptogrphically-secure PRNG, without adding a corresponding deterministic > PRNG is a bad idea, especially with the changes that went in to the examples > that changed all uses of qrand

[Development] CSPRNG vs DPRNG

2017-10-11 Thread Thiago Macieira
Hello I've come to the conclusion that adding QRandomGenerator, a (mostly) cryptogrphically-secure PRNG, without adding a corresponding deterministic PRNG is a bad idea, especially with the changes that went in to the examples that changed all uses of qrand() to QRandomGenerator. We're telling