Function quest_bind::get_quest_seeds
source · pub fn get_quest_seeds<'a: 'b, 'b>(env: &'a QuestEnv) -> &'b [u64]
Expand description
Obtain the seeds presently used in random number generation.
This function returns a reference to the internal array of keys
which have seeded QuEST
’s PRNG. These are the seeds which inform the
outcomes of random functions like measure()
and
measure_with_stats()
, and are set using seed_quest()
and
seed_quest_default()
.
Obtaining QuEST
’s seeds is useful for seeding your own random number
generators, so that a simulation (with random QuEST
measurements, and
your own random decisions) can be precisely repeated later, just by
calling seed_quest()
.
One should not rely, however, upon the reference returned to be
automatically updated after a subsequent call to seed_quest()
or
seed_quest_default()
. Instead, the present function should be
recalled.
Parameters
env
: theQuestEnv
runtime environment
Examples
let mut env = QuestEnv::new();
let seeds = &[1, 2, 3];
seed_quest(&mut env, seeds);
let check_seeds = get_quest_seeds(&env);
assert_eq!(seeds, check_seeds);
See QuEST API for more information.