1. A method for assigning random values to a set of random variables, the method comprising: receiving a set of constraints, wherein each constraint is defined over one or more random variables from the set of random variables, wherein the set of constraints includes one or more modulo constraints that use a modulo operator; rewriting the set of constraints to obtain a new set of constraints, wherein said rewriting includes replacing the one or more modulo constraints with one or more non-modulo constraints that use only non-modulo operators; and assigning random values to the set of random variables based on the new set of constraints.