Make NavMesh move to random positions

I want to make NavMesh move to random Positions.

Vector3 finalPosition;

Vector3 randomDirection = Random.insideUnitSphere * walkRadius;

 randomDirection += transform.position;
 NavMeshHit hit;
 NavMesh.SamplePosition(randomDirection, out hit, walkRadius, 1);
 finalPosition = hit.position;

(I found this on another question)