YARP
Yet Another Robot Platform
RandVector.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include <yarp/math/RandVector.h>
11 #include <yarp/sig/Vector.h>
12 
13 using namespace yarp::sig;
14 using namespace yarp::math;
15 using namespace yarp::math::impl;
16 
17 RandVector::RandVector(int s)
18 {
19  data.resize(s);
20 }
21 
22 void RandVector::resize(int s)
23 {
24  data.resize(s);
25 }
26 
27 void RandVector::init()
28 {
29  rnd.init();
30 }
31 
32 void RandVector::init(int seed)
33 {
34  rnd.init(seed);
35 }
36 
37 const Vector &RandVector::get()
38 {
39  for (size_t k=0;k<data.size(); k++)
40  {
41  data[k]=rnd.get();
42  }
43 
44  return data;
45 }
46 
47 const Vector &RandVector::get(const Vector &min, const Vector &max)
48 {
49  for (size_t k=0;k<data.size(); k++)
50  {
51  data[k]=rnd.get(min[k], max[k]);
52  }
53 
54  return data;
55 }
Vector.h
yarp::sig
Signal processing.
Definition: Image.h:25
yarp::math
Definition: FrameTransform.h:18
yarp::sig::VectorOf< double >
yarp::math::impl
Definition: RandnVector.h:19
RandVector.h