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.68818 + 0.194146⋅i + 0.644524⋅j + 0.270749⋅k
julia> rand(DCM)DCM{Float64}: -0.445756 -0.342946 -0.826855 -0.835573 -0.171954 0.521775 -0.321122 0.923482 -0.209907
julia> rand(EulerAngles)EulerAngles{Float64}: R(Z) : 0.165174 rad ( 9.46376°) R(X) : 3.57263 rad ( 204.697°) R(Y) : 4.71154 rad ( 269.951°)
julia> rand(EulerAngleAxis)EulerAngleAxis{Float64}: Euler angle : 1.8008 rad (103.178°) Euler axis : [-0.794215, 0.0019806, 0.607634]