<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random(cls):
 """ Randomly sample a Quaternion from a distribution uniform in 3D rotation angles. https://www-preview.ri.cmu.edu/pub_files/pub4/kuffner_james_2004_1/kuffner_james_2004_1.pdf Returns ------- q : :class:`gala.coordinates.Quaternion` A randomly sampled ``Quaternion`` instance. """


        s = np.random.uniform()
        s1 = np.sqrt(1 - s)
        s2 = np.sqrt(s)
        t1 = np.random.uniform(0, 2*np.pi)
        t2 = np.random.uniform(0, 2*np.pi)

        w = np.cos(t2)*s2
        x = np.sin(t1)*s1
        y = np.cos(t1)*s1
        z = np.sin(t2)*s2

        return cls([w,x,y,z])