I'm interested in pulling street view data at random within a country.

I can only figure out how to generate a point within a bounding box. Often it pulls data from nearby nations. I'm using a GIS server right now, but I'm interested in removing it from the workflow since it's a pain.

Anybody know of any javascript mapping API that can randomly generate a point within a complex polygon, such as a country boundary?