Skip to content

Commit

Permalink
Use uniform random generator in function random_attitudes().
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Sep 12, 2023
1 parent 38b90aa commit 683c84f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ahrs/common/quaternion.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def random_attitudes(n: int = 1, representation: str = 'quaternion') -> np.ndarr
raise TypeError(f"representation must be a string. Got {type(representation)}")
if representation.lower() not in ['rotmat', 'quaternion']:
raise ValueError(f"Given representation '{representation}' is NOT valid. Try 'rotmat', or 'quaternion'")
u = np.random.random((3, n))
u = np.random.default_rng().uniform(0.0, 1.0, (3, n) if n > 1 else 3)
s1 = np.sqrt(1.0 - u[0])
s2 = np.sqrt(u[0])
t1 = 2.0 * np.pi * u[1]
Expand Down

0 comments on commit 683c84f

Please sign in to comment.