Get Height of Terrain in Script

I would like a script that places a certain number of capsules in various random places around my terrain. The random part is easy, I just use Random.value or something to that effect. However, I want my capsules to be just touching the terrain. Since my terrain is bumpy, I need to be able to get the height of the terrain for a given (x,z) coordinate.

So, given a point on the terrain, how do I get the height of the terrain at that point?

Use Terrain.SampleHeight().