YARP
Yet Another Robot Platform
RandScalar.h
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 #ifndef YARP_MATH_RANDSCALAR_H
8 #define YARP_MATH_RANDSCALAR_H
9 
10 #include <yarp/math/api.h>
11 
12 namespace yarp {
13  namespace math {
14  class RandScalar;
15  }
16 }
17 
29 {
30  void *impl;
31  int seed;
32  RandScalar(const RandScalar &l);
33 public:
34  RandScalar(int seed);
35  RandScalar();
36  ~RandScalar();
37 
42  void init();
43 
48  void init (int seed);
49 
54  int getSeed ()
55  { return seed; }
56 
62  double get();
63 
69  double get(double min, double max);
70 };
71 
72 #endif // YARP_MATH_RANDSCALAR_H
A random number generator, uniform in the range 0-1.
Definition: RandScalar.h:29
void init()
Initialize the random generator using current time (time(0)).
Definition: RandScalar.cpp:57
int getSeed()
Get the seed.
Definition: RandScalar.h:54
double get()
Generate a random number from a uniform distribution.
Definition: RandScalar.cpp:44
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_math_API
Definition: api.h:17