Constraint for randomization

In reply to GURUMOORTHY:

If you randomizing same object you can use following code.

class xyz;

rand int a,b;
int i =0 ;

constraint ab_c {if(i <10 ) (b==a);}

function post_randomize()
i = i+1 ;
endfunction

endclass