[whatwg] Cryptographically strong random numbers

On Feb 16, 2011, at 4:54 PM, David Herman wrote:

> I say: let's make it typed array in the short term, but TC39 will spec it as an array of uint32 according to the binary data spec. We will try to make the binary data spec as backwards compatible as possible with typed arrays anyway. So in the near term, implementors can use typed arrays, but when they have implementations of the full binary data spec, they can change to use those. It'll probably be a slightly backwards-incompatible change, but by keeping them relatively API-compatible, it shouldn't make too much difference in practice. Plus we can warn people that that change is coming.

Dave, most browsers other than FF4 internally box all  integers with with 32-significant bits.  Some may box with 31 or even 30 significant bits.  So if we spec. the value as a  uint32 and (they are truly random enough) then at least half and possible 75% or more of the values in the array will be boxed in many browsers.  Such boxing will have a much higher cost than immediate uint16 values.  That's why I propose 16-bit values.

Allen

Received on Wednesday, 16 February 2011 17:33:44 UTC