Skip to content

Releases: libmir/mir-random

Update to Mir v0.5.0

02 May 09:36
@9il 9il
Compare
Choose a tag to compare
v0.2.4

Update dub.json

Random ndslices generation

30 Mar 03:30
@9il 9il
Compare
Choose a tag to compare
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);