| [ce133f] | 1 | /* | 
|---|
|  | 2 | * Project: MoleCuilder | 
|---|
|  | 3 | * Description: creates and alters molecular systems | 
|---|
|  | 4 | * Copyright (C)  2010 University of Bonn. All rights reserved. | 
|---|
|  | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | /** | 
|---|
| [19bc74] | 9 | * \file randomnumbers.dox | 
|---|
| [ce133f] | 10 | * | 
|---|
| [19bc74] | 11 | * Created on: Oct 28, 2011 | 
|---|
| [ce133f] | 12 | *    Author: heber | 
|---|
|  | 13 | */ | 
|---|
| [750cff] | 14 |  | 
|---|
|  | 15 | /** \page randomnumbers Random Number Generation | 
|---|
|  | 16 | * | 
|---|
|  | 17 | * There is a factory for random number generators present. This implementation | 
|---|
|  | 18 | * has been necessary due to lack of a common interface on the side of the | 
|---|
|  | 19 | * boost::random programmer. Hence, we added a RandomNumberInterface for both | 
|---|
|  | 20 | * engine and distribution and a factory for both and finally the conglomerate | 
|---|
|  | 21 | * for combining both into a single RandomNumberGenerator. | 
|---|
|  | 22 | * | 
|---|
|  | 23 | * Whereever random numbers should be picked with a varying distribution or | 
|---|
|  | 24 | * even better a user-controlled one, this RandomNumberGenerator should be | 
|---|
|  | 25 | * used, e.g. as this | 
|---|
|  | 26 | * \code | 
|---|
|  | 27 | * RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator(); | 
|---|
|  | 28 | * const double rng_min = random.min(); | 
|---|
|  | 29 | * const double rng_max = random.max(); | 
|---|
|  | 30 | * \endcode | 
|---|
|  | 31 | * This returns a reference to a random number generator instance. And also we obtain | 
|---|
|  | 32 | * its RandomNumberGenerator::min() and RandomNumberGenerator::max() values. | 
|---|
|  | 33 | * Then, we may create random values as simple as this: | 
|---|
|  | 34 | * \code | 
|---|
|  | 35 | * double random_value = (random()/((rng_max-rng_min)/2.) - 1.); | 
|---|
|  | 36 | * \endcode | 
|---|
|  | 37 | * which creates a random value within [-1,1]. Note that random() here is | 
|---|
|  | 38 | * RandomNumberGenerator::operator() and not some global function. | 
|---|
|  | 39 | * | 
|---|
|  | 40 | * \note Do not necessarily use the random number generation when just a uniform | 
|---|
|  | 41 | * distribution is required. The implementation is especially designed to allow | 
|---|
|  | 42 | * the user control over the random number distribution. E.g. when filling the void | 
|---|
|  | 43 | * space in a simulation box with molecules he may choose a discrete distribution | 
|---|
|  | 44 | * with a small number of values to have a few, but random orientations of the | 
|---|
|  | 45 | * molecules (MoleculeFillVoidWithMoleculeAction()). | 
|---|
|  | 46 | * | 
|---|
|  | 47 | * \date 2011-10-31 | 
|---|
|  | 48 | * | 
|---|
|  | 49 | */ | 
|---|