sui_move_natives_latest/
random.rs1use crate::legacy_test_cost;
5use move_binary_format::errors::PartialVMResult;
6use move_vm_runtime::native_functions::NativeContext;
7use move_vm_types::{
8 loaded_data::runtime_types::Type, natives::function::NativeResult, values::Value,
9};
10use rand::Rng;
11use smallvec::smallvec;
12use std::collections::VecDeque;
13
14pub fn generate_rand_seed_for_testing(
15 _context: &mut NativeContext,
16 _ty_args: Vec<Type>,
17 _args: VecDeque<Value>,
18) -> PartialVMResult<NativeResult> {
19 let mut seed = [0u8; 32];
20 rand::thread_rng()
21 .try_fill(&mut seed)
22 .expect("should never fail");
23 Ok(NativeResult::ok(
24 legacy_test_cost(),
25 smallvec![Value::vector_u8(seed)],
26 ))
27}