unity – How to make the height to chose random value in the Update but not every frame only when the transform reached the height?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveObject : MonoBehaviour
{
    (SerializeField)
    float speed = 5f;
    //adjust this to change how high it goes
    (SerializeField)
    float height;

    Vector3 pos;

    private void Start()
    {
        height = Random.Range(1.5f, 3f);

        pos = transform.position;
    }
    void Update()
    {
        height = Random.Range(1.5f, 3f);

        float newY = Mathf.Sin(Time.time * speed) * height + pos.y;
        transform.position = new Vector3(transform.position.x, newY, transform.position.z);
    }
}

Now it will change the height value each frame but I want that only when the transform reach the current height than generate new random value.