datex_core/crypto/random.rs
1use crate::runtime::global_context::get_global_context;
2use crate::stdlib::vec::Vec;
3use core::convert::TryInto;
4
5pub fn random_bytes_slice<const SIZE: usize>() -> [u8; SIZE] {
6 let crypto = get_global_context().crypto;
7 crypto.random_bytes(SIZE).try_into().unwrap()
8}
9pub fn random_bytes(size: usize) -> Vec<u8> {
10 let crypto = get_global_context().crypto;
11 crypto.random_bytes(size)
12}