Class
Rng
Random Number Generator
Include Headers
seqan/random.h
Parameters
Random Number Generator specialization. Default: Mersenne Twister Rng |
Specializations
Mersenne Twister 19937 Random Number Generator | |
Functor wrapper for random number generation. |
Metafunctions
Supremum for a given type. | |
Infimum for a given type. | |
Type of the items in the container or behind an iterator. |
Member Functions
Function call operator. |
Functions
Pick a random number using a random number generator object, possibly following the given distribution. | |
Shuffle the given container. |
Examples
The following code shows how to generate random numbers and shuffle a text.
File "random.cpp"
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 |
pickRandomNumber(rng, uniformDouble) == 0.950714
pickRandomNumber(rng, uniformInt) == 27
pickRandomNumber(rng, normal) == 0.419823
pickRandomNumber(rng, logNormal) == 1.22431
pickRandomNumber(rng, logNormal2) == 2.78004
pickRandomNumber(rng, logNormal3) == 0.00155248
shuffle("Hello World!") == o!reWlloHld
SeqAn - Sequence Analysis Library - www.seqan.de