alldifferent random optimized
merged