most smart contracts that rely on "randomness", will require said entropy to be in a number format. A practical way to extract entropy from a arbitrary payload is by using a hashing function. This means that it's intuitive have the entropy in bytes format inside a Tezos smart contract. There are no "direct" ways to convert arbitrary bytes to nat/int in Michelson, so someone proposed (thank you Rodrigo) to go with something like this:
def entropy_to_int(self, param): entropy = sp.bytes("0x00") sp.result(sp.to_int(sp.unpack(sp.bytes("0x050a00000020")+sp.blake2b(entropy), sp.TBls12_381_fr).open_some()))
It looks like it's working as intended. However as this is very security relevant is there a security concern when going with this solution (i.e. skewed/biased distribution of the resulting numbers)?