The OpenD Programming Language

rne

Thread-local instance of the default Random allocated and seeded independently for each thread. Requires TLS.

import mir.random.engine;
static if(THREAD_LOCAL_STORAGE_AVAILABLE)
alias rne = threadLocal!Random

Examples

import mir.random;
import std.complex;

auto c = complex(rne.rand!real, rne.rand!real);

int[10] array;
foreach (ref e; array)
    e = rne.rand!int;
auto picked = array[rne.randIndex(array.length)];

Meta