Skip to content

Commit cf32162

Browse files
committed
Delete leftover function, and add a comment
1 parent a3c2f8a commit cf32162

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

generation-methods.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,13 @@ Trivial, already ubiquitous in the literature.
8383

8484
Drawn from <https://hal.science/hal-03282794v5/document>
8585

86-
function γsectionOO(a,b)
87-
g = γ(a,b)
88-
hi = ceilint(a,b,g)
89-
k = rand(DiscreteUniform(1, hi-1))
90-
(k1,k2) = splitint64(k)
91-
if abs(a) <= abs(b)
92-
return 4*(b/4-k1*g)-k2*g
93-
else
94-
return 4*(a/4+k1*g)+k2*g
95-
end
96-
9786
1. Let |step| be the largest step between floats between |min| and |max|.
9887
2. Let |values| be ceilint(|min|, |max|, |step|).
9988
3. Let |k| be a random int in (1, |values| - 1), using Canon's method.
100-
4. Let |k1| be |k| >> 2, and |k2| be the low 2 bits of |k|.
101-
5. If abs(|min|) <= abs(|max|), return 4\*(|max|/4 - |k1|\*|step|) - |k2|\*|step|.
102-
Otherwise, return 4\*(|min|/4 - k1\*|step|) + |k2|\*|step|.
89+
4. Multiply with 54 bits of precision:
90+
1. Let |k1| be |k| >> 2, and |k2| be the low 2 bits of |k|.
91+
2. If abs(|min|) <= abs(|max|), return 4\*(|max|/4 - |k1|\*|step|) - |k2|\*|step|.
92+
Otherwise, return 4\*(|min|/4 - k1\*|step|) + |k2|\*|step|.
10393

10494

10595
ceilint(|a|, |b|, |g|), implements ceil((b-a)/g) perfectly, and without overflow

0 commit comments

Comments
 (0)