If I understand your first question correctly ; you seem to assume that the “post_randomize” only runs if there are “rand” variables in your class.
This isn’t true. pre_randomize and post_randomize don’t really care if you have or do not have rand variables in your class. The only thing they depend on, is the call to “randomize”. If there is a call to “randomize”, pre_randomize and post_randomize will end up getting called.
Infact, the only way that post_randomize won’t get called if the “randomize” call fails. (You should be escalating randomization failures to errors, to be safe).
I don’t the exact answer to your second question. However, i am glad that increment operators aren’t. supported in constraints. Constraints aren’t solved in any particular order or sequence. All constraints are one big bucket, and the solver tries to satisfy all constraints.
Increment operators say b–, --b, would just add to the confusion and make it logically impossible to solve. Consider the below :
constraint SOLVE {
a == --b;
c == b;
}
What is “c” now ? The decrement operator is going to perform a “b=b-1” after that line is evaluated, but for contraints, it doesn’t work line by line. When will you decrement b ? will you revaluate “a” after b is decremented, and end up in an infinite loop ? What will “c” be ?
Logically, this is a nightmare, if not impossible. Just sticking with “b-1” is easy and solvable.