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


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10