function this = padQueuedX(this, NumWorkers)
% Add random points to this.QueuedX until its height is NumWorkers, or
% until there are no more grid points.
%

%   Copyright 2016-2023 The MathWorks, Inc.

n = size(this.QueuedX,1);
if n < NumWorkers
    if doingGridsearch(this)
        % Add grid X-feasible points
        for i = n+1 : NumWorkers
            [X, this] = gridXFeasiblePoint(this);
            if isempty(X)
                % No more free grid points.
                break;
            else
                this.QueuedX(i,:) = X;
            end
        end
    elseif isequal(this.PrivOptions.AcquisitionFunctionName, 'asha')
        % Add ASHA points to rung 1
        for i = n+1 : NumWorkers
            this.QueuedX(i,:) = randomASHAFeasiblePoints(this,1);
        end
    else
        % Add random X-feasible points
        this.QueuedX = [this.QueuedX; randomXFeasiblePoints(this, NumWorkers-n)];
    end
end
end
