Does anyone know how to simulate a random selection in Daml? My understanding is that I cannot make non-deterministic choices in Daml (I should call an external Oracle and ask for an index), but for testing purposes I should be able to simulate a random selection within the software.
Is that correct? Could someone please help? I cannot find any function such as "choose" "shuffle" or any other related function.
Could someone point me in the right direction please?
Any help would be very much appreciated!!!
As you mentioned, the outcome of interpreting Daml need to be deterministic. Daml is supposed to encode the rules of the game (which need to yield deterministic results for all the players), while code using the Ledger API defines the strategy used, which can introduce an element of randomness to it. If you want to introduce some level of randomness to your workflow, you will need to make it part of the interaction with an off-ledger component.