Releases: libmir/mir-random
Releases · libmir/mir-random
Update to Mir v0.5.0
v0.2.4 Update dub.json
Random ndslices generation
import mir.ndslice: slicedField, slice;
import mir.random;
import mir.random.variable: NormalVariable;
import mir.random.algorithm: field;
auto var = NormalVariable!double(0, 1);
auto rng = Random(unpredictableSeed);
auto sample = rng // passed by reference
.field(var) // construct random field from standard normal distribution
.slicedField(5, 3) // construct random matrix 5 row x 3 col (lazy, without allocation)
.slice; // allocates data of random matrix
import std.stdio;
writeln(sample);