How to find out random winner? #4912
-
I didn't understand how patrick got to know who is the random winner can anyone explain? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @deepak2301, the truth is that there's no real randomness when we work in our local blockchain, the VRFCoordinatorV2Mock uses a hash function to create a pseudo-random number and this number will always be the same because the function always receives the same inputs. So when the number is sent to raffle and the modulo operator is apply to the array of players it always return the same winner. The objective of the VRFCoordinatorV2Mock is to only mimick the behavior of the real VRFCoordinatorV2. |
Beta Was this translation helpful? Give feedback.
Hello @deepak2301, the truth is that there's no real randomness when we work in our local blockchain, the VRFCoordinatorV2Mock uses a hash function to create a pseudo-random number and this number will always be the same because the function always receives the same inputs. So when the number is sent to raffle and the modulo operator is apply to the array of players it always return the same winner.
The objective of the VRFCoordinatorV2Mock is to only mimick the behavior of the real VRFCoordinatorV2.