mir-random
所属分类:collect
开发工具:D
文件大小:0KB
下载次数:0
上传日期:2022-01-10 06:41:13
上 传 者:
sh-1993
说明: 高级随机数生成器,
(Advanced Random Number Generators,)
文件列表:
.circleci/ (0, 2022-01-09)
.circleci/config.yml (468, 2022-01-09)
.travis.yml (1468, 2022-01-09)
Dockerfile (74, 2022-01-09)
appveyor.yml (2916, 2022-01-09)
bench/ (0, 2022-01-09)
bench/Mt19937_bench.d (1667, 2022-01-09)
bench/flex/ (0, 2022-01-09)
bench/flex/normal_dist.d (3114, 2022-01-09)
bench/randindex_bench.d (14072, 2022-01-09)
dub.sdl (1068, 2022-01-09)
examples/ (0, 2022-01-09)
examples/flex_plot.d (3295, 2022-01-09)
examples/flex_plot/ (0, 2022-01-09)
examples/flex_plot/dub.json (217, 2022-01-09)
examples/flex_plot/flex_common_pack/ (0, 2022-01-09)
examples/flex_plot/flex_common_pack/dub.json (327, 2022-01-09)
examples/flex_plot/flex_common_pack/flex_common/ (0, 2022-01-09)
examples/flex_plot/flex_common_pack/flex_common/hatsqueeze.d (4802, 2022-01-09)
examples/flex_plot/flex_common_pack/flex_common/hist.d (3753, 2022-01-09)
examples/flex_plot/flex_common_pack/flex_common/package.d (4627, 2022-01-09)
examples/flex_plot/test_arcsine.d (931, 2022-01-09)
examples/flex_plot/test_beta.d (899, 2022-01-09)
examples/flex_plot/test_density_at_boundaries.d (1018, 2022-01-09)
examples/flex_plot/test_density_with_poles.d (648, 2022-01-09)
examples/flex_plot/test_different_c_values.d (835, 2022-01-09)
examples/flex_plot/test_double_dist.d (1260, 2022-01-09)
examples/flex_plot/test_gamma.d (923, 2022-01-09)
examples/flex_plot/test_inflection_point_at_boundary.d (708, 2022-01-09)
examples/flex_plot/test_near_extrema.d (1249, 2022-01-09)
examples/flex_plot/test_normal.d (807, 2022-01-09)
index.d (3072, 2022-01-09)
meson.build (2200, 2022-01-09)
meson_options.txt (51, 2022-01-09)
source/ (0, 2022-01-09)
source/mir/ (0, 2022-01-09)
source/mir/random/ (0, 2022-01-09)
... ...
[![Dub version](https://img.shields.io/dub/v/mir-random.svg)](http://code.dlang.org/packages/mir-random)
[![Dub downloads](https://img.shields.io/dub/dt/mir-random.svg)](http://code.dlang.org/packages/mir-random)
[![License](https://img.shields.io/dub/l/mir-random.svg)](http://code.dlang.org/packages/mir-random)
[![Circle CI](https://circleci.com/gh/libmir/mir-random.svg?style=svg)](https://circleci.com/gh/libmir/mir-random)
[![Build Status](https://travis-ci.org/libmir/mir-random.svg?branch=master)](https://travis-ci.org/libmir/mir-random)
[![Build status](https://ci.appveyor.com/api/projects/status/github/libmir/mir-random?svg=true)](https://ci.appveyor.com/project/9il/mir-random/branch/master)
[![Gitter](https://img.shields.io/gitter/room/libmir/public.svg)](https://gitter.im/libmir/public)
# 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)
```d
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;
}
```
### Example (10 seconds)
```d
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;
}
```
## 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 than 2^78 unique numbers. In other hand, `std.random.uniform01!real` produces less than `2^31` unique numbers with default Engine.
- Mir Random fixes Phobos integer underflow bugs.
- Additional optimization was added for enumerated types.
- Random [nd-array (ndslice)](https://github.com/libmir/mir-algorithm) generation.
- Bounded integer generation in `randIndex` uses Daniel Lemire's fast alternative to modulo reduction. The throughput increase measured for `randIndex!uint` on an x86-64 processor compiled with LDC 1.6.0 was 1.40x for `Mt19937_64` and 1.73x for `Xoroshiro128Plus`. The throughput increase measured for `randIndex!ulong` was 2.36x for `Mt19937_64` and 4.25x for `Xoroshiro128Plus`.
##### `random.variable` (new)
- Uniform
- Exponential
- Gamma
- Normal
- Cauchy
- ...
##### `random.ndvariable` (new)
- Simplex
- Sphere
- Multivariate Normal
- ...
##### `random.algorithm` (new)
- Ndslice and range API adaptors
##### `random.engine.*` (fixed, reworked, new)
- `opCall` API instead of range interface is used (similar to C++)
- No default and copy constructors are allowed for generators.
- `unpredictableSeed` has not state, returns `size_t`
- `unpredictableSeed!UIntType` overload for seeds of any unsigned type (merged to Phobos)
- Any unsigned generators are allowed.
- `min` property was removed. Any integer generator can normalize its minimum down to zero.
- Mt19937: +100% performance for initialization. (merged to Phobos)
- Mt19937: +54% performance for generation. (merged to Phobos)
- Mt19937: fixed to be more CPU cache friendly. (merged to Phobos)
- 64-bit Mt19937 initialization is fixed (merged to Phobos)
- 64-bit Mt19937 is default for 64-bit targets
- Permuted Congruential Generators (new)
- SplitMix generators (new)
- Fixed XorshiftEngine's support for non-`uint` word sizes & allow various shift directions (merged to Phobos)
- XorshiftStar Generators (new)
- Xoroshiro128Plus generator (new)
- Xoshiro256StarStar & Xoshiro128StarStar_32 generators (new)
近期下载者:
相关文件:
收藏者: