Techniques for SAT solution counting and random sampling from uniform distribution