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.392255 - 0.622145⋅i - 0.602448⋅j - 0.310045⋅kjulia> rand(DCM)DCM{Float64}: -0.192215 0.365768 -0.910641 0.793082 -0.488638 -0.363667 -0.577991 -0.792116 -0.19616julia> rand(EulerAngles)EulerAngles{Float64}: R(X) : 1.57822 rad ( 90.4256°) R(Z) : 1.94814 rad ( 111.62°) R(X) : 3.23421 rad ( 185.306°)julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 1.91966 rad (109.988°) Euler axis : [-0.160956, 0.0204801, 0.986749]julia> rand(CRP)CRP{Float64}: X : + 0.0104117 Y : - 2.39207 Z : + 1.55929julia> rand(MRP)MRP{Float64}: X : - 0.798497 Y : + 0.180045 Z : + 0.118821