YARP
Yet Another Robot Platform
RandVector.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <yarp/math/RandVector.h>
8 #include <yarp/sig/Vector.h>
9 
10 using namespace yarp::sig;
11 using namespace yarp::math;
12 using namespace yarp::math::impl;
13 
14 RandVector::RandVector(int s)
15 {
16  data.resize(s);
17 }
18 
19 void RandVector::resize(int s)
20 {
21  data.resize(s);
22 }
23 
24 void RandVector::init()
25 {
26  rnd.init();
27 }
28 
29 void RandVector::init(int seed)
30 {
31  rnd.init(seed);
32 }
33 
34 const Vector &RandVector::get()
35 {
36  for (size_t k=0;k<data.size(); k++)
37  {
38  data[k]=rnd.get();
39  }
40 
41  return data;
42 }
43 
44 const Vector &RandVector::get(const Vector &min, const Vector &max)
45 {
46  for (size_t k=0;k<data.size(); k++)
47  {
48  data[k]=rnd.get(min[k], max[k]);
49  }
50 
51  return data;
52 }
contains the definition of a Vector type
Signal processing.
Definition: Image.h:22