/
package.d
81 lines (79 loc) · 3.4 KB
/
package.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Written in the D programming language.
/**
* $(D hap._random) is a _random number generation library for the D programming
* language. It is intended as a replacement for Phobos’ $(D std._random), and
* addresses a number of issues encountered in that module: in particular,
* $(D hap._random) implements _random number generators and related entities as
* reference types rather than value types, which avoids a number of problems
* that can arise with the standard library RNGs. It is however largely derivative
* of $(D std._random) and to the greatest extent possible implements the same
* API, with some functional additions, notably the _random distribution ranges.
*
* The library name, $(I hap), is Welsh for “_random” or “chance”. :-)
*
* The functionality implemented by this package is divided into four
* different groups:
*
* $(UL
* $(LI $(B _random number generators), deterministic pseudo-_random algorithms;)
* $(LI $(B _random distributions);)
* $(LI $(B _random adaptors), such as shuffling or sampling objects;)
* $(LI $(B traits) related to _random number generation.)
* )
*
* The $(D hap._random) package will import all of the above functionality.
* Alternatively, individual modules can be imported as required.
*
* Experimental functionality, not fully developed but available as a
* technology preview, includes:
*
* $(UL
* $(LI $(B _random devices), non-deterministic sources of randomness.)
* )
*
* This functionality will not be imported as part of the main $(D hap._random)
* package but can be imported via the individual modules. It should be used
* with some caution, as its API may change significantly in future releases.
*
* Migration: To use $(D hap._random) instead of $(D std._random) it should
* suffice to:
*
* $(UL
* $(LI replace $(D import std._random) with $(D import hap._random))
* $(LI insert $(D new) before every instantiation of an RNG. For example,
* instead of $(D auto rng = Random(unpredictableSeed)) put instead,
* $(D auto rng = new Random(unpredictableSeed)).)
* $(LI optionally, the functions $(D randomCover), $(D randomSample) and
* $(D randomShuffle) may be replaced by $(D cover), $(D sample) and
* $(D shuffle); however, this is optional, not required.)
* )
*
* Note: Currently only one function is known to produce different behaviour to
* its $(D std._random) counterpart: $(D hap._random.distribution.dice) uses a
* different algorithm to $(D std._random.dice).
*
* Warning: Bear in mind that non-reference-type RNGs used in conjunction with
* this package will almost certainly generate erroneous results. In particular
* this package should not be used together with $(D std._random) itself.
*
* Copyright: © 2008-2011 Andrei Alexandrescu,
* 2013 Chris Cain,
* 2013 Andrej Mitrović,
* 2011 Masahiro Nakagawa,
* 2012-2014 Joseph Rushton Wakeling
*
* License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
*
* Authors: $(WEB erdani.org, Andrei Alexandrescu),
* Chris Cain,
* Andrej Mitrović,
* Masahiro Nakagawa,
* $(WEB braingam.es, Joseph Rushton Wakeling)
*
* Source: $(HAPSRC hap/_random/package.d)
*/
module hap.random;
public import hap.random.adaptor;
public import hap.random.distribution;
public import hap.random.generator;
public import hap.random.traits;