diff --git a/sphere.py b/sphere.py
index <HASH>..<HASH> 100644
--- a/sphere.py
+++ b/sphere.py
@@ -54,4 +54,9 @@ def tan_rand(q, seed=9):
     qd = np.cross(rvec, q)
     qd = qd / np.linalg.norm(qd)
 
+    while np.dot(q, qd) > 1e-6:
+        rvec = rs.rand(q.shape[0])
+        qd = np.cross(rvec, q)
+        qd = qd / np.linalg.norm(qd)
+
     return qd
diff --git a/tests/test_sphere.py b/tests/test_sphere.py
index <HASH>..<HASH> 100644
--- a/tests/test_sphere.py
+++ b/tests/test_sphere.py
@@ -10,6 +10,6 @@ def test_two_sphere_random_vector_norm():
 
 def test_two_sphere_tangent_vector():
     vec = sphere.rand(2)
-    vecd = sphere.tan_rand(vec)
+    vecd = sphere.tan_rand(vec, 9)
 
     np.testing.assert_almost_equal(np.dot(vec, vecd), 0)
Make sure that qd is in the tangent space

We'll use a loop and continue to pick random vectors until we get one
that is orthogonal