Spawning object along a y axis with exceptions

Hi, apologies in advance, I’m very new to unity and c#.

In the game I am making, I want an object to come in from the right side of the screen, but only between certain y coordinates (between the top right camera view and the top of the ground). I have managed to figure out the distance between the top right camera and the top of the ground, but I’m a bit stuck as to how I can use that information to get an object to spawn between the 2. Here is the code I’ve got so far:

public class HoleGenerator : MonoBehaviour {

	private GameObject theGround;
	public float distanceFromGround;
	private float bottomRight;

	// Use this for initialization
	void Start () {

	// Update is called once per frame
	void Update () {
		theGround = GameObject.Find ("ground");
		Vector3 topRight = Camera.main.ViewportToWorldPoint (new Vector3 (0, 1, transform.position.z));
		bottomRight = theGround.transform.position.y;

		distanceFromGround = topRight.y - bottomRight;


If you have the top right and bottom right values then you can use Random.Range(min y value ,maxyvalue) to get the value of y for the object and use it to position the GameObject.