Randomizing a dynamic array size

In reply to dave_59:

Dave, we would need to randomize each object of the array after creating it.

   function void post_randomize();
      lst 	 = new[size];
      foreach (lst[i]) begin
	 lst[i]     = new; // need to construct each element
         lst[i].randomize(); // in case there are other fields in the object class that needs to be randomized and not overwritten
	 lst[i].id  = i;
      end
   endfunction