aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2023-02-03 11:45:05 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2023-02-03 11:45:05 -0500
commitcba5bb7a7d8eb17f38757d7117c0c97fda19b708 (patch)
tree066c298696b7572ac401e3bb44e09b8607b143bd /test
parent93325d9a753635448bba381e56c6aa996c99f77f (diff)
Fix the fuzzer's generate-and-adjust method for -z 1
Diffstat (limited to 'test')
-rw-r--r--test/fuzz.bqn10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/fuzz.bqn b/test/fuzz.bqn
index 4f0c3c24..e3d46452 100644
--- a/test/fuzz.bqn
+++ b/test/fuzz.bqn
@@ -64,9 +64,13 @@ RandPart ← ¯1 (⊢-») (Subset∾⊢)○(-⟜1)
(0⌈-⟜1) ⌊ Rand∘(1⌈⌈)⌾((2⋆3+⊢)⁼) + ¯7+Rand∘15 # Near power of two
⟩_randChoose
- P ← ×´opts.zerobound⌈⊢
+ z ← opts.zerobound
+ Squash ← { # Multiply by constant so product is ≤𝕨
+ a←(∧`𝕨>×`÷⊢⋆1+↕∘≠)⊸/∘∨⍟z 𝕩 # Numbers that don't need to go below 1, if z
+ ⌊ 𝕩 × (≠a) √ Sigmoid⊸÷1⌈𝕨÷˜×´a
+ }
Augment ← {
- d ← 1+⌊𝕨÷1⌈P𝕩 # Maximum bound that can be added, plus 1
+ d ← 1+⌊𝕨÷1⌈×´z⌈𝕩 # Maximum bound that can be added, plus 1
C ← 10⊸+ Rand⊸< 1.2⊸√ # Decide whether to add
d (𝕨 𝕊 ⟨∾,∾˜⟩_randChoose⟜RandBound˜)⍟(C⊣) 𝕩
}
@@ -75,7 +79,7 @@ RandPart ← ¯1 (⊢-») (Subset∾⊢)○(-⟜1)
×´¨ (⊐·Rand¨⥊˜∘≠)⊸⊔∘⊢ # Distribute randomly
⟩_randChoose
RandShape ⇐ ⊢ Augment ⟨
- ⊢ (⊢ ⌊∘× ⊢ ≠⊸√ (Sigmoid⊸÷1⌈×´⊸÷˜)) · Rand¨ (RandRank⌈√<Rand)⊸⥊
+ ⊢ Squash · Rand¨ (RandRank⌈√<Rand)⊸⥊
⊢ Combine⟜Factor 1⌈RandBound
⟩_randChoose
}