probability or statistics – How to find the inverse of CDF of geometric function?

The cdf of geometric distribution is given by $ F(x)=1-(1-p)^x$.
I want to calculate the inverse of it, for example, $F^{-1}(U)$

I am doing the following

f(x_) := 1 - (1 - p)^x;  InverseFunction(f(u))

But I do not get anything.

my ultimate goal is to generate sample of a random variable that has geometric distribution.