Andrew Haley wrote:
...

My negative comment was wrong, indeed. There is no
stack error and the length of the cycle is 2^32 - 1:
"n xtest ." returns n, at least for all
n I tried.

variable (rnd)

: rnd ( -- n )
        (rnd) 32B@
        dup #13   lshift xor $FFFFFFFF and
        dup #17   rshift xor $FFFFFFFF and
        dup DUP 5 lshift xor (rnd) 32B! ;

: xtest ( x -- )
        1 (rnd) !
        $100000000 0 DO  rnd over = ?LEAVE  LOOP
        ." outcome = " H. ;

-marcel

Reply via email to