Function getQuESTSeeds

Source
pub unsafe extern "C" fn getQuESTSeeds(
    env: QuESTEnv,
    seeds: *mut *mut c_ulong,
    numSeeds: *mut c_int,
)
Expand description

Obtain the seeds presently used in random number generation.

This function sets argument \p seeds to the address of the array of keys which have seeded QuEST’s Mersenne Twister random number generator. \p numSeeds is set to the length of \p seeds. These are the seeds which inform the outcomes of random functions like measure(), and are set using seedQuEST() and seedQuESTDefault().

The output \p seeds array must not be freed, and should not be modified.

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 seedQuEST().

Note this function merely sets the arguments to the attributes for \p env. I.e.

    unsigned long int* seeds;
    int numSeeds;
    getQuESTSeeds(env, &seeds, &numSeeds);

    func(seeds, numSeeds);

is equivalent to

    func(env.seeds, env.numSeeds);

However, one should not rely upon their local pointer from getQuESTSeeds() to be automatically updated after a subsequent call to seedQuEST() or seedQuESTDefault(). Instead, getQuESTSeeds() should be recalled.

@see

  • seedQuEST()
  • seedQuESTDefault()

@ingroup debug @param[in] env the ::QuESTEnv runtime environment @param[in] seeds a pointer to an unitialised array to be modified @param[in] numSeeds a pointer to an integer to be modified @author Tyson Jones