You need to initialize RNG_Seedwith something "random." And this is actually a bit problematic on a deterministic machine such as a computer.
, , , , HW , .
, , .
, ( 16b), BIOS - :
xor ah,ah ; ah = 0
int 1Ah ; returns in cx:dx ticks since midnight (18.2Hz ticks)
; let mix the cx:dx a bit together to get a bit more entropy out of it
rol cx,8
xor dx,cx
xor [RNG_Seed],dx ; "add" that entropy to the original seed
, ( ), "" :
, , ( 3 ) , inc counter , 4 (3 + = 4 * 4 = 16 ). (xor) RNG_Seed.
RNG ( , , ).
EDIT: , , , add, xor. , BIOS , xor - (, , BTW, exe-), , 4: 4: 4: 4 ( xor, , 16b), xor . BIOS, xor .
4: 4: 4: 4 , 16b , xor-ed . , , int 16h, ah=1, , , , 16 ( , ), 4 , [] . , 16b , (.. - 10000-13000 → 2 , 8 ). , 4 , , 16b. , , . , , , , , , . , ( ~ 20 , dosbox DOS).