Random rotations

Sometimes it is necessary to generate random rotations. For example, if you are testing a stochastic system numerically, you need to perform a Monte Carlo simulation sampling the initial conditions. ReferenceFrameRotations.jl defines rand function for all rotation representations, which samples a random rotation uniformly in SO(3).

julia> rand(Quaternion)Quaternion{Float64}:
  + 0.547234 - 0.612486⋅i - 0.251102⋅j + 0.512195⋅k
julia> rand(DCM)DCM{Float64}: 0.637532 -0.733323 0.236199 0.251131 0.487644 0.836144 -0.728345 -0.473751 0.495049
julia> rand(EulerAngles)EulerAngles{Float64}: R(Y) : 1.53143 rad ( 87.7445°) R(X) : 0.0587999 rad ( 3.36898°) R(Z) : 5.39348 rad ( 309.024°)
julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 2.79025 rad (159.869°) Euler axis : [0.433002, 0.700645, -0.567103]
julia> rand(CRP)CRP{Float64}: X : - 4.35337 Y : + 2.40669 Z : + 0.924787
julia> rand(MRP)MRP{Float64}: X : + 1.11253 Y : + 0.459671 Z : + 0.692937