In reply to mlsxdx:
your requirement is still not very clear to me.
btw, try this idea
rand c_typ_e Cs;
rand shortint arr_sz;
rand e_typ_e E_set; // e_typ_e distribution set in C0 and C1
e_typ_e Es;
-
constraint block to solve Cs (size is 8) and E_set (size is 4) first
-
post_randomize() for final Es (size 8)
based on Cs and E_set constrainted resultsint C0_idx_q[] = Cs.find_index with (item == C0); int C1_idx_q[] = Cs.find_index with (item == C1);
e.g. Cs: C0,C0,C1,C1,C0,C1,C1,C0 // num of C0 = num of C1
C0_idx_q = {0,1,4,7}
C1_idx_q = {2,3,5,6}
E_set= {E0, E1, E2, E3}foreach (C0_idx_q[i]) Es[C0_idx_q[i]] = E_set[i];
E_set.shuffle();
foreacj (C1_idx_q[i]) Es[C1_idx_q[i]] = E_set[i];