12-07-2011, 01:46 PM
Boriel, I know the compiler's pseudorandom number generator is better than the one in the ROM.
Seen this:
<!-- m --><a class="postlink" href="http://www.worldofspectrum.org/forums/showthread.php?t=23070">http://www.worldofspectrum.org/forums/s ... hp?t=23070</a><!-- m -->
?
If it's smaller, faster or better, you might want to consider
For posterity, an 8 bit result with 32 bit seed that passes diehard test for 32 bit entropy:
Seen this:
<!-- m --><a class="postlink" href="http://www.worldofspectrum.org/forums/showthread.php?t=23070">http://www.worldofspectrum.org/forums/s ... hp?t=23070</a><!-- m -->
?
If it's smaller, faster or better, you might want to consider
For posterity, an 8 bit result with 32 bit seed that passes diehard test for 32 bit entropy:
Code:
rnd ld hl,0xA280 ; xz -> yw
ld de,0xC0DE ; yw -> zt
ld (rnd+1),de ; x = y, z = w
ld a,e ; w = w ^ ( w << 3 )
add a,a
add a,a
add a,a
xor e
ld e,a
ld a,h ; t = x ^ (x << 1)
add a,a
xor h
ld d,a
rra ; t = t ^ (t >> 1) ^ w
xor d
xor e
ld h,l ; y = z
ld l,a ; w = t
ld (rnd+4),hl
ret