1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; generate random number
3 ;; this is quite fast, quality pseudo-random number generator
4 ;; it uses 32-bit seeds (and still returns a 16-bit result)
5 ;; an advantage here is that they've been tested and passed randomness
6 ;; tests (all of thee ones offered by CAcert labs)
7 ;; it combines a 32-bit Linear Feedback Shift Register and a 32-bit LCG
8 ;; it has a period of 18,446,744,069,414,584,320 (roughly 18.4 quintillion)
9 ;; LFSR taps: 0,2,6,7 = 11000101
12 ;; rndSeed0: lower 2 bytes of the first seed
13 ;; rndSeed1: upper 2 bytes of the first seed
14 ;; rndSeed2: lower 2 bytes of the second seed
15 ;; rndSeed3: upper 2 bytes of the second seed
16 ;; WARNING! second seed must not be zero
19 ;; BC,DE: DEAD (can be used as lower quality values, but are not independent of HL)