I want to generate a sequece S[ ] of members chosen randomly from 4 finite sets, namely set1 ,set2,set3 and set4. Where all sets have the same size and are not empty.
Basically,for each i , I can chose randomly a set then can chose randomly the term S[i] from the chosen set.
But I know it is not random enough because , some members belong to 2 sets . Call the set of such members as Border . I know no member belongs to 3 or more sets.
Finally ,I concluded that , I must check , for each i , that if the chosen term S[i] is in Border.
If it is then I probabilistically discard this S[i] on the chance of ( 1 on 2 ) and chose new S[i] again , allowing the discarded S[i] = the new S[i]. And checking must be done exactly once for each i.
Is this algorithm exactly random?
Thank you very much .
PS, I noticed one point . Some members belong to 3 sets at most. So let me call the sets of such members as Border2 and Border3 respectively. Where the post fixes indicate the number of sets to which members belong . Please let me know how to generate S exactly randomly .