YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RandnVector.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
8#include <yarp/sig/Vector.h>
9
10using namespace yarp::sig;
11using namespace yarp::math;
12using namespace yarp::math::impl;
13
14RandnVector::RandnVector(int s)
15{
16 data.resize(s);
17}
18
20{
21 data.resize(s);
22}
23
25{
26 rnd.init();
27}
28
29void RandnVector::init(int seed)
30{
31 rnd.init(seed);
32}
33
34const Vector &RandnVector::get(double u, double sigma)
35{
36 for (size_t k=0;k<data.size(); k++)
37 {
38 data[k]=rnd.get(u, sigma);
39 }
40
41 return data;
42}
43
44const Vector &RandnVector::get(const Vector &u, const Vector &sigma)
45{
46 for (size_t k=0;k<data.size(); k++)
47 {
48 data[k]=rnd.get(u[k], sigma[k]);
49 }
50
51 return data;
52}
contains the definition of a Vector type
double get(double u=0.0, double sigma=1.0)
Generate a randomly generated number, drawn from a normal distribution.
void init()
Initialize the generator.
const yarp::sig::Vector & get(const yarp::sig::Vector &u, const yarp::sig::Vector &sigma)
void resize(size_t size) override
Resize the vector.
Definition Vector.h:221
size_t size() const
Definition Vector.h:341