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.410233 + 0.336623⋅i - 0.135209⋅j - 0.836727⋅k
julia> rand(DCM)DCM{Float64}: 0.615988 -0.764296 0.190814 0.762603 0.517841 -0.387656 0.197473 0.384306 0.901839
julia> rand(EulerAngles)EulerAngles{Float64}: R(X) : 5.71524 rad ( 327.459°) R(Z) : 4.94248 rad ( 283.183°) R(Y) : 4.04504 rad ( 231.764°)
julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 2.25376 rad (129.131°) Euler axis : [-0.0254095, 0.387628, -0.921466]