Keep it civil, do not flame or bait other users. If you notice anything illegal or inappropriate being discussed, contact an administrator or moderator.
1. Load the API search normally, with &limit=1 added to the request to limit it to return 1 item. (The limit is to save bandwidth, and at this point not strictly necessary.)
2. Get the number of results from the count in the API response.
3. Generate a random number between 1 and that number inclusive.
4. Load the API search with &limit=1&offset={N}, where {N} is the number you generated. The limit will limit the number of results to 1, and offset will load the N'th page of results. Since each page is 1 result long, you will get the N'th result for the search, which will be random since you generated N randomly.
You will now have one random post from any possible tag search, including the main post listing.