Added constraints to rand_test