Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRandom.h
1 /********************************************************************************
2 * *
3 * R a n d o m N u m b e r G e n e r a t o r *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2007,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXRANDOM_H
22 #define FXRANDOM_H
23 
24 namespace FX {
25 
26 
31 class FXRandom {
32 private:
33  FXulong state;
34 public:
35 
39  FXRandom();
40 
45  FXRandom(FXulong s);
46 
50  FXRandom(const FXRandom& s):state(s.state){}
51 
55  FXRandom& operator=(const FXRandom& s){ state=s.state; return *this; }
56 
60  FXulong next();
61 
65  void seed(FXulong s);
66 
70  FXulong getState() const { return state; }
71 
75  void setState(FXulong s){ state=s; }
76 
80  FXulong randLong();
81 
85  FXfloat randFloat();
86 
90  FXdouble randDouble();
91  };
92 
93 }
94 
95 
96 #endif

Copyright © 1997-2016 Jeroen van der Zijp