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 a rand function for all rotation representations. For all representations except EulerAngles, it samples a random rotation uniformly in SO(3). rand(EulerAngles) instead samples each angular coordinate uniformly in [0, 2π) and selects an axis sequence uniformly; this coordinate-wise distribution is not uniform over SO(3).
julia> rand(Quaternion)Quaternion{Float64}: - 0.171581 - 0.720293⋅i + 0.602687⋅j + 0.297498⋅kjulia> rand(DCM)DCM{Float64}: 0.329635 -0.365157 0.870632 -0.864032 0.254992 0.434083 -0.380513 -0.895343 -0.231453julia> rand(EulerAngles)EulerAngles{Float64}: R(X) : 4.18216 rad ( 239.62°) R(Z) : 5.46777 rad ( 313.28°) R(X) : 1.45175 rad ( 83.179°)julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 2.78874 rad (159.783°) Euler axis : [-0.087938, -0.724529, -0.683611]julia> rand(CRP)CRP{Float64}: X : + 1.49688 Y : + 1.51475 Z : - 0.976916julia> rand(MRP)MRP{Float64}: X : - 0.671787 Y : + 1.15361 Z : + 0.581151