Let $f:[0,1] \to \mathbb R$ be a continuous and monotonic function. Given $r>0$, I would like to construct a continuous function $g:[0,1] \to \mathbb R$ such that
$g$ is NOT monotonic.
$\max_{x\in [0,1]} |f(x)-g(x)| < r$.
The intuition is clear as I draw in the picture. But I fail to construct such required function.
Could you please shed me some light? Thank you so much!

For sufficiently high $K$, $$g(x) = f(x) + \frac r2 \sin Kx$$ should do the trick.