how can I ensure repeated images do not appear consecutively?

I need to present 12 images randomly; 6 are unique but 3 of them are repeated. How can I ensure that identical images are not presented consecutively?

Constraining randomization is not currently possible with version 4.0.7.