Constraint

In reply to Er. Shipra:

You could create a parameter (or variable) representing the value you want and constraint your array to that parameter

class C;
  rand int A[101];
  parameter int P[101] = '{default:0, 4:6, 5:6, 100:89};
  constraint c{foreach(A[i]) A[i]==P[i];}
endclass

Or you can simply make an assigment to A without randomizing it.