LESSON 9: Mock VRF why is random deterministic? #1155
-
So in Video when we are writing test "picks a winner, resets, and sends money"
and in github repo it is number 2
So I wonder why there is the difference and also, why is it deterministic and always the same, where does randomness come from in mock? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey, I recall Patrick explaining why so in a discussion. I will rephrase it. Yes, your curiosity is valid - it is because for our Mock, it is not random, ie, it is deterministic. It always returns the same winner, there is no randomness involved. Hope this answers your doubt! |
Beta Was this translation helpful? Give feedback.
-
@adriadrop In the video Patrick used a deployer account everywhere that was And now come the part, why we have fix number? so in mocks, it does not change it every time returns the same while but in the testnet it will. |
Beta Was this translation helpful? Give feedback.
@adriadrop In the video Patrick used a deployer account everywhere that was
account no 0
but in the GitHub repo in beforeEach, it is player fromaccount no 1
that is why you are seeing 2 instead of one and you can see in the video Patrick starts loop from index 1 but in the repo, it is from 2. It is the only reason you can remove the player account and use deployer as in video as use 1 instead of 2 everywhere.And now come the part, why we have fix number? so in mocks, it does not change it every time returns the same while but in the testnet it will.