> a = np.random.bytes(4*n).view(dtype='<u4')

If you for example want a post-processing that just use 32 bits of
randomness per deviate, you can e.g. do something like this:

r =
np.random.bytes(4*n).view(dtype='<u4').astype(float)/float(0xFFFFFFFF+1)

I have no idea what R does, though.

NumPy's post-processing is similar to this (except without temporary
arrays):

a = (np.random.bytes(4*n).view(dtype='<u4') >> 5).astype(np.int32)
b = (np.random.bytes(4*n).view(dtype='<u4') >> 6).astype(np.int32)
r = (a * 67108864.0 + b) / 9007199254740992.0

Sturla

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to