Add more wall reflection/randomisation

This commit is contained in:
2024-12-22 10:42:10 +00:00
parent 84821a1531
commit acba8de359
4 changed files with 122 additions and 79 deletions
+11
View File
@@ -121,3 +121,14 @@ randsSpread (a, b) i
randsOnCirc :: RandomGen g => Int -> State g [Float]
randsOnCirc = randsSpread (0, 2 * pi)
randPeakedParam :: RandomGen g => Int -> Float -> Float -> Float -> State g Float
randPeakedParam i a b c = do
x <- state $ randomR (-1, 1)
let y = x ^ i
return $ if y < 0
then a + y * (a-b)
else b + y * (c-b)
randPeaked :: RandomGen g => Float -> Float -> Float -> State g Float
randPeaked = randPeakedParam 3