3

In the contract, I would like to have cards distributed randomly to each user like so:

  • User1: A
  • User2: B
  • User3: C
  • User4: D

Each user should only be able to determine what their card is, and each card should only be distributed once per user (no duplicates).

Is it possible to create a contract that would do this?

1 Answer 1

2

Yes, you can do it using a set (which prevents from duplication) and then use boost random number in range, and pop cards out when player receives them. https://www.boost.org/doc/libs/1_66_0/doc/html/boost_random/tutorial.html#boost_random.tutorial.generating_integers_in_a_range

Also to distribute anonymously you can use end to end encryption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.