How to generate a number with non-consecutive 1's

In reply to ben@SystemVerilog.us:

Thanks Ben! That worked. Do you know why my constraint failed?


foreach(a[i])
  if(i) a[i-1] != a[i];

FYI - I am big fan of your assertion implementations. It is always a good learning!