IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
random.h
Go to the documentation of this file.
1 /**
2  * \file IMP/random.h \brief Random number generators used by IMP.
3  *
4  * Copyright 2007-2021 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPKERNEL_RANDOM_H
9 #define IMPKERNEL_RANDOM_H
10 
11 #include <IMP/kernel_config.h>
12 #include <IMP/Vector.h>
13 #include <boost/random/mersenne_twister.hpp>
14 
15 IMPKERNEL_BEGIN_NAMESPACE
16 
17 #ifndef SWIG // the RNG is defined explicitly in pyext/IMP_kernel.random.i
18 typedef ::boost::mt19937 RandomNumberGenerator;
19 
20 //! A shared non-GPU random number generator
21 /** The random number generator is seeded based on command line specified flag.
22  Otherwise, the default seed is retrieved from among either
23  boost::random_device, `/dev/urandom`, or the system clock, based on which
24  method is available in this priority order.
25 
26  To set the seed, call the `seed` method, which takes a single integer
27  argument. This object is also callable, and returns a new random integer
28  on each call.
29 
30 This generator can be used by the
31 [Boost.Random](http://www.boost.org/doc/libs/1_39_0/libs/random/index.html)
32 distributions.
33  */
34 extern IMPKERNELEXPORT RandomNumberGenerator random_number_generator;
35 #endif
36 
37 //! Return the initial random seed.
38 /** To set the seed or get random values, see IMP::random_number_generator.
39  */
40 IMPKERNELEXPORT boost::uint64_t get_random_seed();
41 
42 
43 IMPKERNEL_END_NAMESPACE
44 
45 #endif /* IMPKERNEL_RANDOM_H */
boost::uint64_t get_random_seed()
Return the initial random seed.
A class for storing lists of IMP items.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.