Generate unique values in an array uisng 'unique' keyword

hi…
I am trying to use unique keyword to generate unique elements in an array…
But, I am getting a compilation error if I am running the following code…


module test;

	class image;
		rand int pixel[$];
		constraint img{unique{pixel};}
		constraint xyz{pixel.size == 10;}
	endclass

image I;

initial 
	begin
		I = new();
		I.randomize();
			for (int j= 0; j<10; j++)
				$write(" pixel[%0d] = %0d   ", j,I.pixel[j]);
	end
endmodule

The following is the error… plz help me in solving this…

Error: image.sv(5): near “unique”: syntax error, unexpected unique**

This works fine with my version of Questa. Perhaps you need to upgrade as this is a new feature of 1800-2012.

In reply to dave_59:

Thanks a lot Dave