Skip to content

Releases: libmir/mir-random

Add .save property to XoshiroEngine, Xoroshiro128Plus, PermutedCongruentialEngine, and PhobosRandom wrapper

23 Mar 21:29
01088a5
Compare
Choose a tag to compare

Makes mir.random PRNGs that satisfy Phobos std.random.isUniformRNG also satisfy std.range.primitives.isForwardRange. Affected PRNGs and templates:

Prior to this the only mir.random PRNGs that implemented .save were mir.random.engine.splitmix.SplitMix64 and Splittable64.

v2.2.10: Upgrade pyd to v0.13.0 (#121)

18 Jan 08:28
@9il 9il
Compare
Choose a tag to compare
* Upgrade pyd to v0.13.0

Use a newer version which does not depend on class deallocator.

* List dub explicitly to work around segfault

Optional Mir Algorithm dependency

02 Nov 05:34
@9il 9il
Compare
Choose a tag to compare
Mark mir.random.variable & mir.random.ndvariable opCall as const when…

… possible (#105)

* Mark mir.random.variable opCall `const` when appropriate

All except: Bernoulli2Variable, LogNormalVariable, NormalVariable, &
StudentTVariable. Also affected the `min` and `max` properties of some
variables.

* Mark DirichletVariable & SimplexVariable opCall as `const`

This commit does not do this for MultivariateNormalVariable or for
SphereVariable opCall because future optimizations might make them
non-const.

v2.0.0

25 Oct 14:24
@9il 9il
d260126
Compare
Choose a tag to compare
Update mir-algorithm version (#103)

API and safety improvements

14 Feb 14:48
@9il 9il
b91f9d2
Compare
Choose a tag to compare
  1. default params from random variable constructors was removed
  2. convention functions for random variable construction were added
  3. randomSlice was added to mir.random.algorithm
  4. field API rework for complex numbers
  5. default engine rne was added to some algorithms

Fix 32bit DMD `double` generation.

09 Feb 07:29
@9il 9il
Compare
Choose a tag to compare
v0.3.6

fix travis config

API Improvements

05 Feb 11:56
@9il 9il
07833fb
Compare
Choose a tag to compare

Most of the API is duplicated to be used with default thread-local random engine. See also the first example in the README.

v0.3.0

22 Dec 00:36
Compare
Choose a tag to compare

Release v0.3.0

Performance Increases

We now use Daniel Lemire's fast alternative to modulo reduction. Compiling with LDC 1.6.0 for x86-64, Mt19937_64 randIndex throughput increased 40% for uint and 136% for ulong. Xoroshiro128Plus randIndex throughput increased 73% for uint and 325% for ulong.

The required mir-algorithm version has increased to v0.7.0 because extMul is necessary for the ulong version.

New since v0.2.8:

  • New engine: SplitMix64 / Splittable64
  • Convenience functions related to thread-local randoms: rne (like std.random rndGen); threadLocal!Engine for arbitrary engine; & ways of mucking about with the bookkeeping state that most people won't need but a few have requested in the past.
  • Made some engines compatible with APIs that expect std.random-style UniformRNG. Compatible as-is: Xoroshiro128Plus; all predefined PCG engines; and the new SplitMix64/Splittable64 engines. For any others there is an adaptor. Copy-constructors are disabled so they will only work with functions that "do the right thing" and take PRNGs by reference and don't make implicit copies of them.

Fixed since v0.2.8:

  • Changed many parts of the library to be @safe.
  • Linux GETRANDOM in unpredictableSeed now works on non-x86/x86-64 architectures.
  • Removed endian-dependency when producing 64-bit values from a native-32-bit PRNG.

Changed APIs

  • The versions of genRandomBlocking/genRandomNonBlocking that take a pointer and a length are no longer @trusted. Instead there are trusted overloads for both that take a ubyte[].
  • mir.random.algorithm has been changed in the interest of memory safety. You can still write unsafe code but now if you try to write @safe code the library will let you. Instead of taking engines by reference and storing their addresses (which could result in the stored address outliving the engine), instead the various functions require arguments to be either objects or pointers to structs. For local-scoped engines there are templates with alias parameters. This is a major API change so feedback/criticism is welcome.

v0.2.8

24 Oct 03:24
Compare
Choose a tag to compare

Release v0.2.8

Additions:

  • Added xorshift1024*φ and xoroshiro128+ generators (mir.random.engine.xorshift : Xorshift1024StarPhi, Xoroshiro128Plus)
  • Mt19937 and Mt19937_64 can be seeded from array or ndslice
  • mir.random.engine.preferHighBits!T to query new optional enum preferHighBits

Improvements:

  • When the high bits of a PRNG's output are known to have better statistical properties than the low bits, use high bits when not all bits of output are required.
  • On macOS, OpenBSD, and NetBSD, use arc4random_buf in unpredictableSeed and genRandomNonBlocking.

Bugfixes:

  • Fix isSaturatedRandomEngine!T not working when T.opCall is a function template.
  • Fix address-based increment for PCGs in unique_stream mode.
  • Incorporated upstream fix for seeding a MCG with a seed that's a multiple of the modulus.

Major additions

27 Sep 04:32
@9il 9il
Compare
Choose a tag to compare
  • System level genRandomNonBlocking and genRandomBlocking was added to mir.random.engine by Sebastian Wilzbach (@wilzbach). unpredictableSeed became more secure.
  • Permuted Congruential Generator (PCG) was added by Nicholas Wilson (@thewilsonator) After a while it will replace Mersenne Twister for default engine (Random alias).
  • SphereVariable, SimplexVariable, DirichletVariable, and MultivariateNormalVariable was added to mir.random.ndvariable by Simon Bürger (@krox). Multivariate normal RNG uses private Cholesky decomposition, which has not unittests yet. PRs are welcome.