function X = randomXFeasiblePoints(this, N)
% Generate N random initial points X that satisfy the
% xConstraint. Return them in transformed space.
%

%   Copyright 2016-2022 The MathWorks, Inc.

X = bayesoptim.uniformPointsWithinBounds(this.PrivOptions.NumRestartCandidates, ...
    this.PrivOptions.VarSpec.LBTrans, this.PrivOptions.VarSpec.UBTrans);
% Minimize the number of calls to isInputFeasible
Idxs = [];
for i = 1:size(X,1)
    if isInputFeasible(this, X(i,:))
        Idxs(end+1) = i;
        if numel(Idxs) == N
            break;
        end
    end
end
X = X(Idxs,:);
end
