function Pf = EvalPf(d,Z,DesignOpts,std, idxDes, idxEnv)

% Loop over all the design samples
for ii = 1:size(d,1)
    
    % Loop over each dimension of the design variable:
    for jj = 1 : size(d(ii,:),1)
        % I assume a fixed standard definition is given for each design
        % variable
        DesignOpts.Marginals(jj).Moments = [d(ii,jj), std] ;
    end
    
    
    % Build an Input object
    myInput = uq_createInput(XIOpts,'-private') ;
    % Sample the random  variables locally
    D = uq_getSample(myInput,1e4) ;
    % Now recombine D and Z according to how they enter in your final
    % objective function
    X = zeros(N,length(idxDes)+length(idxEnv)) ;
    X(:,idxDES) = D ;
    X(:,idxEnv) = Z ;
    
    % Evaluate the limit-state function
    Y(ii,:) = myConstraint(X) ;
    % Get the corresponding failure probability
    Pf(ii,:) = sum(Y(ii,:)<0)/N ;
end
end




