Home

Awesome

Dub version Dub downloads License

Circle CI Build Status Build status Gitter

mir-random

Advanced Random Number Generators

Documentation - http://mir-random.libmir.org/

This library is for general-purpose random number generation. Do not use it for cryptography or secret generation.

Example (3 seconds)

void main()
{
    import mir.random;
    import mir.random.variable: normalVar;
    import mir.random.algorithm: randomSlice;

    auto sample = normalVar.randomSlice(10);

    import std.stdio;
    sample[$.randIndex].writeln;
}
<!-- [![Open on run.dlang.io](https://img.shields.io/badge/run.dlang.io-open-blue.svg)](https://run.dlang.io/is/mTVJL6) -->

Example (10 seconds)

void main()
{
    import mir.random;
    import mir.random.variable: normalVar;
    import mir.random.algorithm: randomSlice;

    // Engines are allocated on stack or global
    auto rng = Random(unpredictableSeed);
    auto sample = rng.randomSlice(normalVar, 10);

    import std.stdio;
    sample[rng.randIndex($)].writeln;
}
<!-- [![Open on run.dlang.io](https://img.shields.io/badge/run.dlang.io-open-blue.svg)](https://run.dlang.io/is/F1Iucp) -->

Comparison with Phobos

random (new implementation and API)
random.variable (new)
random.ndvariable (new)
random.algorithm (new)
random.engine.* (fixed, reworked, new)