Constraint for randomization

In reply to GURUMOORTHY:

If you are creating object before each randomization then

class xyz;

rand int a,b;
static int i =0 ;

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

function post_randomize()
i = i+1 ;
endfunction

endclass