cleaning this up to
function forward
q=p(2);
r=p(1);
s=p(1);
switch(q)
case(00): if(n==0) sample of k valid;
case(01): if(k==0) m++ carry into n;
case(1X): if(k==1) m++
carry into n;
endswitch;
if(n and q=00) k^=r;
end
forward
one could point out that this is of no use, and you may have been
right. the critical point is when m is just about to carry into
n and
make n==0 again. this is called the injection point. with
0.5 chance of
1 being injected for sampling and 0.25 chance of 0
being injected for
sampling. and 0.25 chance of being 50:50
randomized for the next
injection attempt. this leads to twice
as many ones being injected, but
1 is sampled only half as much
and so the effects cancel and 50:50
sampling bias is produced
which is quite useless, blah, blah
dont say i told you so just yet, this code below uses a
reinjection
pricipal.
function forward
q=p(2);
r=p(1);
s=p(2);
switch(q)
case(00): if(n==0) sample of k valid;
case(01): if(k==0) begin
/* a strange mod 2 effect and 3/8
of injectable zeros recycled */
m++ carry into n;
if(s!=00
and n) m++ no carry;
end;
case(1X): if(k==1) m++ carry into
n;
endswitch;
if(n and q=00) k^=r;
end;
end forward
this makes the 0.25 injection of zero become a (0.25)*5/8
injection
probability, and recycles the randomization process.
after calculation
of the probability series, an 16/5:1 ratio of
1s to 0 s are injected,
which at a 2:1 sample rate gives 8/5:1
overall sampled bias. all steps
in forward are reversable as all
operations are non destructive and the
if conditions are not
altered by the then actions.
is this ok???
Reply