The thermal scalar and random walks in curved spacetime