BRL-CAD
randmt.h
Go to the documentation of this file.
1 /* R A N D M T . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 /*----------------------------------------------------------------------*/
22 /* @file randmt.h */
23 /** @addtogroup rnd */
24 /** @{ */
25 
26 /**
27  * @brief
28  * Mersenne Twister random number generation as defined by MT19937.
29  *
30  * Generates one pseudorandom real number (double) which is uniformly
31  * distributed on [0, 1]-interval, for each call.
32  *
33  * @par Usage:
34  @code
35  double d;
36 
37  bn_randmt_seed(integer_seed);
38 
39  while (NEED_MORE_RAND_NUMBERS) {
40  d = bn_randmt();
41  }
42  @endcode
43  *
44  */
45 
46 #ifndef BN_RANDMT_H
47 #define BN_RANDMT_H
48 
49 #include "common.h"
50 #include "bn/defines.h"
51 
53 
54 BN_EXPORT extern double bn_randmt(void);
55 BN_EXPORT extern void bn_randmt_seed(unsigned long seed);
56 
58 
59 #endif /* BN_RANDMT_H */
60 /** @} */
61 /*
62  * Local Variables:
63  * mode: C
64  * tab-width: 8
65  * indent-tabs-mode: t
66  * c-file-style: "stroustrup"
67  * End:
68  * ex: shiftwidth=4 tabstop=8
69  */
Header file for the BRL-CAD common definitions.
#define __BEGIN_DECLS
Definition: common.h:73
void bn_randmt_seed(unsigned long seed)
Definition: randmt.c:144
#define __END_DECLS
Definition: common.h:74
double bn_randmt(void)
Mersenne Twister random number generation as defined by MT19937.
Definition: randmt.c:149