Constraint

the above logic is good to generate required values.
but why below logic is not working:

class packet;
  rand bit [3:0] addr;
 
  constraint addr_range { addr dist { [1:7] := 0,[8:15] := 1 }; }
endclass