I've been trying to use most common
let mut rng = rand::thread_rng();
let winner_pos = rng.gen_range(0..10);
way to get a random number and use it in one of the contract's messages. But it throws a bunch of errors like:
error[E0277]: the size for values of type `u128` cannot be known at compilation time
|
26 | bids: ink_storage::Mapping<AccountId, Balance>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
which are pretty misleading.
What is an alternative way to generate a random number then?
rand
since they typically get entropy from the operating system, which is not accessible from the context of a smart contract running on a blockchain.