I have an array value randomization related question. Lets say we have an two arrays.
int a [4] = {0,1,2,3};
int b [8];
Now I want to generate all elements of b such it contains all elements of a in some random order but not unique. The following piece of code does not solve problem. The constraint solver could generate b as following.
int b [8]= {0,1,2,2,1,1,0,0};
I want b to have all elements of a but in some random repeated way.
Is there some way we can achieve this ?
This will ensure that all elements of ‘a’ are inside ‘b’. Otherwise, it would be possible to randomize a value for ‘b’ that, for example, doesn’t contain ‘a[0]’.