# Replacing all values in a table > $T$ [duplicate]

I want to generate a table of Euclidean distances from the points in a list to a given point, e.g.:

Table[EuclideanDistance[MyList[[i]], c], {i, 1, Length[MyList]}]


Moreover, when EuclideanDistance returns a value greater than $T$, I'd like to replace that value with a given real number $R$. Is there a simple way to do this?

Why not use Clip?

MyList = RandomReal[{-1, 1}, 10];
c = {0, 0};
t = 1;
r = -1;

Clip[
Table[EuclideanDistance[MyList[[i]], c], {i, 1, Length[MyList]}],
{0, 1}, {0, r}]

(* ==>  {0.9957995322104205,0.3452581732209688,0.016464628727136405,
-1,-1,0.5914902487316964,0.8531216593853862,-1,0.9996775567985703,
-1} *)


Here, r = -1 is the value that replaces any number above the threshold t = 1.

Here's a variation on Jens method that does the calculation by mapping the function EuclideanDistance onto the list and then clipping the result:

myList = RandomReal[{-1, 1}, 10];
c = {0, 0}; t = 1; r = -1;
Clip[EuclideanDistance[#, c] & /@ myList, {0, 1}, {0, r}]