daily pastebin goal
11%
SHARE
TWEET

prng24 (eZ80)

Zeda Apr 27th, 2015 (edited) 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. prng24:
  2. ;expects ADL mode
  3. ;collab with Runer112
  4. ;;Output:
  5. ;;    HL is a pseudo-random int
  6. ;;    A and BC are pseudo-random, but much weaker and smaller cycles
  7. ;;    Preserves DE
  8. ;;41cc, super fast
  9. ;;30 bytes
  10. ;;period length: 281,474,959,933,440
  11. seed1=$+1
  12.     ld hl,9999
  13.     ld b,h
  14.     ld c,l
  15.     add hl,hl
  16.     add hl,hl
  17.     inc l
  18.     add hl,bc
  19.     ld (seed1),hl
  20. seed2=$+1
  21.     ld hl,987
  22.     add hl,hl
  23.     sbc a,a
  24.     and %00101101
  25.     xor l
  26.     ld l,a
  27.     ld (seed2),hl
  28.     add hl,bc
  29.     ret
RAW Paste Data
Top