These are chat archives for libmir/public

Nov 2016
Ilya Yaroshenko
Nov 25 2016 13:29
import std.range, std.stdio;

import random;
import random.variable: NormalVariable;

auto rng = Random(unpredictableSeed);        // Engines are allocated on stack or global
auto sample = rng                            // Engines are passed by reference to algorithms
    .randomRange(NormalVariable!double(0, 1))// Random variables are passed by value
    .take(1000)                              // Fix sample length to 1000 elements (Input Range API)
    .array;                                  // Allocates memory and performs computation

This is current API. Range API fans should be happy :smile: