1 // Copyright (C) 2012-2019 The VPaint Developers.
2 // See the COPYRIGHT file at the top-level directory of this distribution
3 // and at https://github.com/dalboris/vpaint/blob/master/COPYRIGHT
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef RANDOM_H
18 #define RANDOM_H
19 
20 /*
21  * Random.h
22  *
23  * A convenient class to generate random numbers
24  *
25  */
26 
27 class Random
28 {
29 public:
30     // Initiliaze with a seed. The second one use the current time as seed.
31     static void setSeed(int seed);
32     static void setRandomSeed();
33 
34     // Get a random double, between [0,1[ or [min,max[
35     static double random();
36     static double random(double min, double max);
37 
38     // Get a random int, between [0,RAND_MAX] or [min,max]
39     static int randomInt();
40     static int randomInt(int min, int max);
41 };
42 
43 #endif
44