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