function D = random_dither(A)
    RND = rand(size(A));
    D = RND + A;
    D(D>=1) = 1;
    D(D<1) = 0;
end