rne

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

  1. alias rne = threadLocal!Random
    static if(THREAD_LOCAL_STORAGE_AVAILABLE)
    alias rne = threadLocal!Random
  2. Random rne [@property getter]

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