random_generator.h
Go to the documentation of this file.
1 /*
2  * @brief sim_loc_random implements random number generators.
3  *
4  * Copyright (C) 2019 Ing.-Buero Dr. Michael Lehning, Hildesheim
5  * Copyright (C) 2019 SICK AG, Waldkirch
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are met:
23  *
24  * * Redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer.
26  * * Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  * * Neither the name of SICK AG nor the names of its
30  * contributors may be used to endorse or promote products derived from
31  * this software without specific prior written permission
32  * * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its
33  * contributors may be used to endorse or promote products derived from
34  * this software without specific prior written permission
35  *
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46  * POSSIBILITY OF SUCH DAMAGE.
47  *
48  * Authors:
49  * Michael Lehning <michael.lehning@lehning.de>
50  *
51  * Copyright 2019 SICK AG
52  * Copyright 2019 Ing.-Buero Dr. Michael Lehning
53  *
54  */
55 #ifndef __SIM_LOC_RANDOM_H_INCLUDED
56 #define __SIM_LOC_RANDOM_H_INCLUDED
57 
58 #include <boost/random.hpp>
59 
60 namespace sick_scan
61 {
66  {
67  public:
68 
74  UniformRandomInteger(int lower_bound = 0, int upper_bound = 255);
75 
80  int generate(void);
81 
87  std::vector<uint8_t> generate(int data_size);
88 
89  protected:
90 
91  /*
92  * member data
93  */
94 
95  boost::mt19937 m_random_engine;
96  boost::uniform_int<> m_uniform_distribution;
97  boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_random_generator;
98 
99  }; // class UniformIntegerRandom
100 
105  {
106  public:
107 
112 
118  std::string generate(int length);
119 
120 
121  protected:
122 
123  /*
124  * member data
125  */
127  static const std::string s_ascii_chars;
128 
129  }; // class UniformRandomAsciiString
130 
131 } // namespace sick_scan
132 #endif // __SIM_LOC_RANDOM_H_INCLUDED
sick_scan::UniformRandomInteger::m_uniform_distribution
boost::uniform_int m_uniform_distribution
uniform integer distribution
Definition: random_generator.h:96
sick_scan::UniformRandomAsciiString::generate
std::string generate(int length)
Definition: random_generator.cpp:107
sick_scan::UniformRandomAsciiString
Definition: random_generator.h:104
sick_scan::UniformRandomInteger
Definition: random_generator.h:65
sick_scan::UniformRandomInteger::m_random_generator
boost::variate_generator< boost::mt19937 &, boost::uniform_int<> > m_random_generator
random number generator (glues mersenne engine and distribution)
Definition: random_generator.h:97
sick_scan
Definition: abstract_parser.cpp:50
sick_scan::UniformRandomAsciiString::s_ascii_chars
static const std::string s_ascii_chars
list of ascii chars: " !\"#$%&'()*+,-./0123456789:;=?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmno...
Definition: random_generator.h:127
sick_scan::UniformRandomInteger::generate
int generate(void)
Definition: random_generator.cpp:75
sick_scan::UniformRandomInteger::UniformRandomInteger
UniformRandomInteger(int lower_bound=0, int upper_bound=255)
Definition: random_generator.cpp:67
sick_scan::UniformRandomInteger::m_random_engine
boost::mt19937 m_random_engine
mersenne twister engine
Definition: random_generator.h:95
length
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
sick_scan::UniformRandomAsciiString::m_random_generator
UniformRandomInteger m_random_generator
random number generator
Definition: random_generator.h:126
sick_scan::UniformRandomAsciiString::UniformRandomAsciiString
UniformRandomAsciiString()
Definition: random_generator.cpp:98


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19