1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use fvm_shared::clock::ChainEpoch;
use fvm_shared::randomness::RANDOMNESS_LENGTH;
use crate::{sys, SyscallResult};
pub fn get_chain_randomness(
dst: i64,
round: ChainEpoch,
entropy: &[u8],
) -> SyscallResult<[u8; RANDOMNESS_LENGTH]> {
let ret = unsafe {
sys::rand::get_chain_randomness(dst, round as i64, entropy.as_ptr(), entropy.len() as u32)?
};
Ok(ret)
}
pub fn get_beacon_randomness(
dst: i64,
round: ChainEpoch,
entropy: &[u8],
) -> SyscallResult<[u8; RANDOMNESS_LENGTH]> {
let ret = unsafe {
sys::rand::get_beacon_randomness(dst, round as i64, entropy.as_ptr(), entropy.len() as u32)?
};
Ok(ret)
}