rand samples a legal value on each successful randomization and may repeat immediately. randc keeps cyclic state so successive calls on the same object visit each value in its legal domain before repeating.
Reason it through
- Use
randfor normal constrained-random stimulus. A repeated value is legal and is not evidence that randomization failed. - Use
randcfor a small, stable scalar or enum domain when no-repeat traversal is itself the requirement. - A new object starts a new
randccycle. Tight or changing constraints can exhaust the remaining cyclic choices and make a later solve fail.
| Choice | Across calls | Best use | Main risk |
|---|---|---|---|
rand | Legal values may repeat | General stimulus | Assuming every value appears quickly |
randc | No repeat within its cycle | Small IDs or enum sweeps | State, cost, and constraint exhaustion |
