mir-random 0.0.1-beta1
Dlang Random Number Generators
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
mir-random
Professional Random Number Generators
Documentation: http://docs.random.dlang.io/latest/index.html
import std.range, std.stdio;
import mir.random;
import mir.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
writeln(sample);
Comparison with Phobos
- Does not depend on DRuntime (Better C concept)
random
(new implementation and API)
- Mir Random
rand!float
/rand!double
/rand!real
generates saturated real random numbers in(-1, 1)
. For example,rand!real
can produce more then 2^78 unique numbers. In other hand,std.random.uniform01!real
produces less then2^31
unique numbers with default Engine. - Mir Random fixes Phobos integer underflow bugs.
- Addition optization was added for enumerated types.
ramdom.variable
(new)
- Uniform
- Exponential
- Gamma
- Normal
- Cauchy
- ...
random.algorithm
(new)
- Range API adaptors
random.engine.*
(fixed, reworked)
opCall
API instead of range interface is used (similar to C++)- No default and copy constructors are allowed for generators.
@RandomEngine
UDA is used for for Engines instead of a enum flag.unpredictableSeed
has not state, returnssize_t
- Any unsigned generators are allowed.
min
proporty was removed. Any integer generator can normalize its minimum down to zero.- 64-bit Mt19937 initialization is fixed
- 64-bit Mt19937 is default for 64-bit targets
- [WIP] additional Engines, see https://github.com/libmir/mir-random/pulls
- Registered by Ilia Ki
- 0.0.1-beta1 released 8 years ago
- libmir/mir-random
- BSL-1.0
- Copyright © 2016, Ilya Yaroshenko
- Authors:
- Dependencies:
- none
- Versions:
-
2.2.19 2021-Sep-01 2.2.18 2021-May-20 2.2.17 2021-May-20 2.2.16 2021-Mar-22 2.2.15 2020-Sep-01 - Download Stats:
-
-
66 downloads today
-
286 downloads this week
-
1312 downloads this month
-
304918 downloads total
-
- Score:
- 4.8
- Short URL:
- mir-random.dub.pm