On 16/07/17 17:16, Francois Pussault wrote: > this fucking bullshit procédure make only zero's ....But what I need > is a -1/0 ending state (on/off) or similar what I misunderstood ?
The xor-shift generator produces a full cycle of every bit patter except all zeroes: that is to say, zero is not prt of its sequence. You need to start with a nonzero value. If you can't exclude that possibility, do this: : rnd ( -- n) (rnd) @ dup 0= or dup 13 lshift xor dup 17 rshift xor dup DUP 5 lshift xor (rnd) ! ; -- Andrew Haley