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.826 + 0.39732⋅i - 0.318209⋅j - 0.242083⋅k
julia> rand(DCM)DCM{Float64}: 0.0614045 0.551877 0.831662 0.587651 0.653519 -0.477052 -0.806781 0.51802 -0.284182
julia> rand(EulerAngles)EulerAngles{Float64}: R(X) : 6.18009 rad ( 354.093°) R(Y) : 4.18932 rad ( 240.03°) R(X) : 5.46073 rad ( 312.877°)
julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 1.38224 rad (79.1963°) Euler axis : [-0.144305, -0.395613, -0.90701]