YARP
Yet Another Robot Platform
RandScalar.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 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 #ifndef YARP_MATH_RANDSCALAR_H
11 #define YARP_MATH_RANDSCALAR_H
12 
13 #include <yarp/math/api.h>
14 
15 namespace yarp {
16  namespace math {
17  class RandScalar;
18  }
19 }
20 
32 {
33  void *impl;
34  int seed;
35  RandScalar(const RandScalar &l);
36 public:
37  RandScalar(int seed);
38  RandScalar();
39  ~RandScalar();
40 
45  void init();
46 
51  void init (int seed);
52 
57  int getSeed ()
58  { return seed; }
59 
65  double get();
66 
72  double get(double min, double max);
73 };
74 
75 #endif // YARP_MATH_RANDSCALAR_H
A random number generator, uniform in the range 0-1.
Definition: RandScalar.h:32
void init()
Initialize the random generator using current time (time(0)).
Definition: RandScalar.cpp:60
int getSeed()
Get the seed.
Definition: RandScalar.h:57
double get()
Generate a random number from a uniform distribution.
Definition: RandScalar.cpp:47
The main, catch-all namespace for YARP.
Definition: environment.h:25
#define YARP_math_API
Definition: api.h:18