random is a pseudorandom number generator that derives a deterministic seed state from the current block number and block height. In Contracting, these environment variables are not automatically supplied. The ContractingClient also does not current have support for this feature, so you will have to automatically update your environment with a block height and hash that you would like to use.
Simply do the following:
client = ContractingClient()
rc = client.get_contract('random_contract')
This method is required to be run once per transaction. If it is not called, the contract will fail. You must seed every contract like so:
Besides seeding, the rest of the module follows Python random 1:1. Here are the methods you can use and reference the Python manual to read more about how each one behaves.
random.randint(a: int, b: int)
random.choices(l: list, k: int)
Telegram: t.me/lamdenchatDiscord: discord.gg/xjBgcAAUpSReddit: reddit.com/r/lamden