Not to be confused with idempotence.[4].
The litmus test.
If:
g(f(args)); g(f(args));
is equivalent[5] to:
final T t = f(args); g(t); g(t);
for any function g and any arguments to f (which we have called args) then we say that f is referentially transparent.
g
f
args
[4] See Idempotence versus Referential Transparency
[5] has an indistinguishable program outcome.