|
|
|||
File indexing completed on 2026-06-02 08:48:24
0001 /* 0002 * RandomGenerator.h 0003 * 0004 * Created on: Aug 1, 2016 0005 * Author: Pawel Sznajder 0006 */ 0007 0008 #ifndef RANDOMGENERATOR_H_ 0009 #define RANDOMGENERATOR_H_ 0010 0011 #include <ElementaryUtils/parameters/Parameters.h> 0012 #include <stddef.h> 0013 #include <string> 0014 0015 namespace NumA { 0016 0017 class RandomGenerator { 0018 0019 public: 0020 0021 static const std::string PARAM_NAME_SEED; ///< Seed. 0022 0023 /** 0024 * Default constructor. 0025 */ 0026 RandomGenerator(); 0027 0028 /** 0029 * Destructor 0030 */ 0031 virtual ~RandomGenerator(); 0032 0033 /** 0034 * Provides a generic method to configure all types of integrations by passing a Parameters object. 0035 * Parameters class represents a list of couples key/value (see Parameters class documentation for more info). 0036 * 0037 * @param parameters ElemUtils::Parameters object. 0038 */ 0039 void configure(const ElemUtils::Parameters ¶meters); 0040 0041 /** 0042 * Set new seed 0043 * @param seed '0' for time-based seed or fixed seed. 0044 * @return Value of new seed. 0045 */ 0046 size_t setSeed(size_t seed); 0047 0048 /** 0049 * Get seed 0050 */ 0051 size_t getSeed() const; 0052 0053 /** 0054 * Dice double precision number from flat distribution in range [0, 1). 0055 */ 0056 double diceFlat() const; 0057 0058 /** 0059 * Dice double precision number from flat distribution in given range. 0060 * @param min Min. 0061 * @param max Max.. 0062 */ 0063 double diceFlat(double min, double max) const; 0064 0065 /** 0066 * Dice double precision number from normal distribution with mean = 0 and sigma = 1. 0067 */ 0068 double diceNormal() const; 0069 0070 /** 0071 * Dice double precision number from normal distribution with given mean and sigma. 0072 * @param mean Mean. 0073 * @param sigma Sigma. 0074 */ 0075 double diceNormal(double mean, double sigma) const; 0076 0077 /** 0078 * Dice double precision number from exponential distribution with lambda (negative slope) = 1. 0079 */ 0080 double diceExp() const; 0081 0082 /** 0083 * Dice double precision number from exponential distribution with given lambda (negative slope). 0084 */ 0085 double diceExp(double lambda) const; 0086 0087 /** 0088 * Dice double precision number from exponential distribution with given lambda (negative slope) in given range. 0089 */ 0090 double diceExp(double min, double max, double lambda) const; 0091 0092 private: 0093 0094 /** 0095 * Seed. 0096 */ 0097 size_t m_seed; 0098 }; 0099 0100 } 0101 0102 #endif /* RANDOMGENERATOR_H_ */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|