Skip to content

Commit 131e509

Browse files
[48] Moved the message to the Quaternion package as part of merging
the Extensions package with the aforementioned.
1 parent 7314191 commit 131e509

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/Math-Quaternion/Quaternion.class.st

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ Quaternion class >> qr: qr qi: qi qj: qj qk: qk [
5555
qk: qk
5656
]
5757

58+
{ #category : #'*Math-Quaternion' }
59+
Quaternion class >> random [
60+
"Answers a random quaternion with abs at most one."
61+
62+
^ (0.5 - Float random)
63+
i: (0.5 - Float random)
64+
j: (0.5 - Float random)
65+
k: (0.5 - Float random).
66+
]
67+
5868
{ #category : #'constants access' }
5969
Quaternion class >> zero [
6070
^self

src/Math-Quaternion/Quaternion.extension.st

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ Quaternion >> random [
3131
^ self class random * self.
3232
]
3333

34+
{ #category : #'*Math-Quaternion' }
35+
Quaternion class >> random [
36+
"Answers a random quaternion with abs at most one."
37+
38+
^ (0.5 - Float random)
39+
i: (0.5 - Float random)
40+
j: (0.5 - Float random)
41+
k: (0.5 - Float random).
42+
]
43+
3444
{ #category : #'*Math-Quaternion' }
3545
Quaternion >> subtractToPolynomial: aPolynomial [
3646
"(c) Copyrights Didier BESSET, 1999, all rights reserved.

0 commit comments

Comments
 (0)