Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / glibmm2 / glib / glibmm / random.h
1 // -*- c++ -*-
2 #ifndef _GLIBMM_RANDOM_H
3 #define _GLIBMM_RANDOM_H
4
5 /* $Id: random.h 749 2008-12-10 14:23:33Z jjongsma $ */
6
7 /* random.h
8  *
9  * Copyright (C) 2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <glib.h>
27
28 extern "C" { typedef struct _GRand GRand; }
29
30
31 namespace Glib
32 {
33
34 /** @defgroup Random Random Numbers
35  * Pseudo random number generator.
36  * @{
37  */
38
39 class Rand
40 {
41 public:
42   Rand();
43   explicit Rand(guint32 seed);
44   ~Rand();
45
46   void set_seed(guint32 seed);
47
48   bool get_bool();
49
50   guint32 get_int();
51   gint32  get_int_range(gint32 begin, gint32 end);
52
53   double get_double();
54   double get_double_range(double begin, double end);
55
56   GRand*       gobj()       { return gobject_; }
57   const GRand* gobj() const { return gobject_; }
58
59 private:
60   GRand* gobject_;
61
62   // noncopyable
63   Rand(const Rand&);
64   Rand& operator=(const Rand&);
65 };
66
67 /** @} group Random */
68
69 } // namespace Glib
70
71
72 #endif /* _GLIBMM_RANDOM_H */
73