[Development] websockets (was RE: Qt 5.3 Feature freeze is coming quite soon...)

Olivier Goffart olivier at woboq.com
Mon Feb 10 20:34:20 CET 2014


On Sunday 09 February 2014 21:35:18 Thiago Macieira wrote:
> Em dom 09 fev 2014, às 23:57:24, Olivier Goffart escreveu:
> > I think you are making it more complicated than it  need to be.
> > qrand has maximum 32bit entropy (because it uses rand_r internally which
> > only  has 32 bit state), therefore calling it several time in a row is
> > totally useless and don't add entropy.
> 
> Actually, on most platforms it returns only 15 bits of data.
> 
> If you want to make multiple calls, I want to see RAND_MAX in the source

In that case it can indeed be called twice.

> code.
> > static QElapsedTimer t;
> > return qsrand(t.nsecsElapsed());
> 
> You forgot to start() the timer. Which means this is a really poor choice
> for seeing the random engine, since a newly-started elapsed timer will be
> very close to zero.

I relied on the fact that the statics are zero initialized.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list