strusBase  0.17
pseudoRandom.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef _STRUS_BASE_PSEUDO_RANDOM_NUMBERS_HPP_INCLUDED
9 #define _STRUS_BASE_PSEUDO_RANDOM_NUMBERS_HPP_INCLUDED
10 #include <ctime>
13 #include <cstdlib>
14 #include <cstdarg>
15 #include <stdexcept>
16 #include "strus/base/stdint.h"
17 
18 namespace strus
19 {
20 
23 {
24 public:
26  PseudoRandom();
28  explicit PseudoRandom( int seed_);
29 
34  int get( int start_, int end_);
35 
41  int select( unsigned int psize, int firstValue, ...);
42 
43 private:
44  unsigned int m_value;
45  unsigned int m_incr;
46 };
47 
48 }//namespace
49 #endif
50 
51 
52 
PseudoRandom()
Constructor with seed derived from current date (granularity day)
Pseudo random generator. Fast generator for series of pseudo random numbers where the security is not...
Definition: pseudoRandom.hpp:22
int select(unsigned int psize, int firstValue,...)
Get the next "random" value of a specified set.