]> git.mxchange.org Git - simgear.git/blob - simgear/math/sg_random.h
Ignore generated binaries.
[simgear.git] / simgear / math / sg_random.h
1 /**
2  * \file sg_random.h
3  * Routines to handle random number generation and hide platform differences.
4  */
5
6 // Written by Curtis Olson, started July 1997.
7 //
8 // Copyright (C) 1997  Curtis L. Olson  - http://www.flightgear.org/~curt
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Library General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 // Library General Public License for more details.
19 //
20 // You should have received a copy of the GNU Library General Public
21 // License along with this library; if not, write to the
22 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 // Boston, MA  02111-1307, USA.
24 //
25 // $Id$
26
27
28 #ifndef _SG_RANDOM_H
29 #define _SG_RANDOM_H
30
31
32 #ifdef __cplusplus                                                          
33 extern "C" {                            
34 #endif                                   
35
36
37 /**
38  * Seed the random number generater with time() so we don't see the
39  * same sequence every time.
40  */
41 void sg_srandom_time();
42
43 /**
44  * Seed the random number generater with time() in 10 minute intervals
45  * so we get the same sequence within 10 minutes interval.
46  * This is useful for synchronizing two display systems.
47  */
48 void sg_srandom_time_10();
49
50 /**
51  * Seed the random number generater with your own seed so can set up
52  * repeatable randomization.
53  * @param seed random number generator seed
54  */
55 void sg_srandom( unsigned int seed );
56
57 /**
58  * Return a random number between [0.0, 1.0)
59  * @return next "random" number in the "random" sequence
60  */
61 double sg_random();
62
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68
69 #endif // _SG_RANDOM_H
70
71