pub fn testing_rng() -> TestingRng
Expand description
Return a new, possibly deterministic, RNG for use in tests.
This function is only for testing: using it elsewhere may make your code insecure!
The type of this RNG will depend on the value of ARTI_TEST_PRNG
:
- If ARTI_TEST_PRNG is
random
or unset, we’ll use a real seeded PRNG. - If ARTI_TEST_PRNG is
deterministic
, we’ll use a standard canned PRNG seed. - If ARTI_TEST_PRNG is a hexadecimal string, we’ll use that as the PRNG seed.
We’ll print the value of this RNG seed to stdout, so that if the test fails, you’ll know what seed to use in reproducing it.
§Panics
Panics if the environment variable is set to an invalid value.
(If your code must not panic, then it is not test code, and you should not be using this function.)