setThreadLocalSeed

Sets or resets the seed of threadLocal!Engine using the given arguments. It is not necessary to call this except if you wish to ensure the PRNG uses a known seed.

static if(THREAD_LOCAL_STORAGE_AVAILABLE)
void
setThreadLocalSeed
(
Engine
A...
)
(
auto ref A seed
)
if (
is(Engine == struct)
&&
A.length >= 1
&&
is(typeof(
(
ref A a
)
=> Engine(a)
))
)

Examples

import mir.random;

alias rnd = threadLocal!Random;

setThreadLocalSeed!Random(123);
immutable float x = rnd.rand!float;

assert(x != rnd.rand!float);

setThreadLocalSeed!Random(123);
immutable float y = rnd.rand!float;

assert(x == y);