-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random numbers #72
Comments
randomNumber = Random.inRange 1 10
main = lift (plainText . show) randomNumber |
This is another example: http://elm-lang.org/edit/examples/Reactive/Randomize.elm Does that clarify things? |
But.. I have a question about random numbers too. randomNumber = Random.inRange 1 10
secondRandomNumber = Random.inRange 1 10
thirdRandomNumber = randomNumber
together a b c = (show a) ++ " " ++ (show b) ++ " " ++ (show c)
main = lift plainText $ lift3 together randomNumber secondRandomNumber thirdRandomNumber This code returns 7 1 7 for me, but shouldn't it return 7 7 7? Is there some magic difference between referring to a signal directly and through a function? |
I am not sure if this is "bad" behavior, but I think it is okay. It does not have side-effects observable outside of the Elm RTS, so it does not limit any opportunities to prune unused signals. |
Thank you |
Can you give me an example of how to do display a random number on the screen?
(I know this is not an issue. I am just trying to understand)
-Thanks
Drew
480-840-5406
The text was updated successfully, but these errors were encountered: