Function get_random

Source
pub fn get_random() -> u64
Expand description

Returns a u64 value chosen by Antithesis.

You should use this value immediately rather than using it later. If you delay, then it is possible for the simulation to branch in between receiving the random data and using it. These branches will have the same random value, which defeats the purpose of branching.

Similarly, do not use the value to seed a pseudo-random number generator. The PRNG will produce a deterministic sequence of pseudo-random values based on the seed, so if the simulation branches, the PRNG will use the same sequence of values in all branches.

§Example

use antithesis_sdk::random;

let value = random::get_random();
println!("Random value(u64): {value}");