Created
April 18, 2020 18:10
-
-
Save dimsuz/4d5dad68296df381821584935165b81f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
randomInUnitSphere :: State StdGen (V3 Double) | |
randomInUnitSphere = iterateWhile (\v -> norm v ^ 2 >= 1) random' | |
random' :: Random a => State StdGen a | |
random' = state random | |
-- Error | |
-- /home/dima/projects/raytracing/src/Main.hs:100:59-65: error: | |
-- • No instance for (Random (V3 Double)) | |
-- arising from a use of ‘random'’ | |
-- • In the second argument of ‘iterateWhile’, namely ‘random'’ | |
-- In the expression: iterateWhile (\ v -> norm v ^ 2 >= 1) random' | |
-- In an equation for ‘randomInUnitSphere’: | |
-- randomInUnitSphere = iterateWhile (\ v -> norm v ^ 2 >= 1) random' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment