code: def random(cls):
          
          r1, r2, r3 = np.random.random(3)
  
          q1 = sqrt(1.0 - r1) * (sin(2 * pi * r2))
          q2 = sqrt(1.0 - r1) * (cos(2 * pi * r2))
          q3 = sqrt(r1)       * (sin(2 * pi * r3))
          q4 = sqrt(r1)       * (cos(2 * pi * r3))
  
          return cls(q1, q2, q3, q4)
docs: Generate a random unit quaternion.
  
          Uniformly distributed across the rotation space
          As per: http://planning.cs.uiuc.edu/node198.html