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-2024 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 /** @addtogroup bn_rmt
23  *
24  * @brief
25  * Mersenne Twister random number generation as defined by MT19937.
26  *
27  * Generates one pseudorandom real number (double) which is uniformly
28  * distributed on [0, 1]-interval, for each call.
29  *
30  * @par Usage:
31  @code
32  double d;
33 
34  bn_randmt_seed(integer_seed);
35 
36  while (NEED_MORE_RAND_NUMBERS) {
37  d = bn_randmt();
38  }
39  @endcode
40  *
41  */
42 /** @{ */
43 /** @file randmt.h */
44 
45 #ifndef BN_RANDMT_H
46 #define BN_RANDMT_H
47 
48 #include "common.h"
49 #include "bn/defines.h"
50 
51 __BEGIN_DECLS
52 
53 BN_EXPORT extern double bn_randmt(void);
54 BN_EXPORT extern void bn_randmt_seed(unsigned long seed);
55 
56 __END_DECLS
57 
58 #endif /* BN_RANDMT_H */
59 /** @} */
60 /*
61  * Local Variables:
62  * mode: C
63  * tab-width: 8
64  * indent-tabs-mode: t
65  * c-file-style: "stroustrup"
66  * End:
67  * ex: shiftwidth=4 tabstop=8
68  */
Header file for the BRL-CAD common definitions.
void bn_randmt_seed(unsigned long seed)
double bn_randmt(void)