Forum - S. Astrov. Pseudorandom number generator.

ZX Review #3-4
(C) Sergey Astrov,
Cheboksary, 1996.


   Pseudo-random

             numbers.


   I confess! And corrects his mistake I made in the 
description of the random number generator in the ZX-REVIEW 
6'95. RND_3 - a pseudo-random bits, and to get

pseudo-word, the procedure should cause 16 times
and this negates the speed of the generator. With a single call 
to 15 bits of the old numbers are present in the new number, 
adds only one random bits.


   The new implementation is devoid of these shortcomings, but 
zero is still unattainable. The idea of ​​getting the numbers 
practically the same as in my previous generator. Deleted 
checking for null value Be careful! The length of the generator 
23 bytes are used only registers AF and HL.

1410.
RND_32 LD HL, (SEED)

          CALL RND
RND LD A, H

          ADD HL, HL

          XOR H

          ADD HL, HL

          ADD HL, HL

          ADD HL, HL

          XOR H

          ADD HL, HL

          ADD HL, HL

          XOR H

          ADD HL, HL

          ADD HL, HL

          LD L, A

          LD (SEED), HL

          RET
SEED DEFW # FFFF; NOT ZERO!
2

   IFC: Sergei have one question: does anyone know which bytes
replace the printer's firmware
CM-6337 to when you turn
immediately established an alternative encoding?

********************************