In reply to sharatk:
The
solve before construct only works with integral rand variables, not class handles.
You need to explain what “incorrect randomization” means. What are you expecting? Also please give an example.
Your second example has the constraint
arr[i].A == 1;, which means it is no longer random.