blob: 8fde4f1f58919fb39b885b25439194f66c33bddd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// $Id: mmdb_math_rand.h $
// =================================================================
//
// CCP4 Coordinate Library: support of coordinate-related
// functionality in protein crystallography applications.
//
// Copyright (C) Eugene Krissinel 2000-2013.
//
// This library is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 3, modified in accordance with the provisions
// of the license to address the requirements of UK law.
//
// You should have received a copy of the modified GNU Lesser
// General Public License along with this library. If not, copies
// may be downloaded from http://www.ccp4.ac.uk/ccp4license.php
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// =================================================================
//
// 12.09.13 <-- Date of Last Modification.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// -----------------------------------------------------------------
//
// **** Module : Rand <interface>
// ~~~~~~~~~
// **** Classes : RandomNumber ( random number generator )
// ~~~~~~~~~
//
// (C) E. Krissinel 1997-2013
//
// =================================================================
//
#ifndef __MMDB_MATH_Rand__
#define __MMDB_MATH_Rand__
#include "mmdb_io_file.h"
namespace mmdb {
namespace math {
// -------------------------------------------------------------
enum RN_MAX_SEED {
_RN_MAX_IJ = 31328,
_RN_MAX_KL = 30081
};
DefineClass(RandomNumber);
class RandomNumber {
public :
RandomNumber ( long IJ=0, long KL=0 );
void Init ( long IJ=0, long KL=0 );
realtype gauss_rnd(); //!< Gaussian random numbers
realtype random (); //!< Uniform [0..1] random number generator
realtype srandom (); //!< Uniform [-1..1] random number generator
void read ( io::RFile f );
void write ( io::RFile f );
protected :
long I97,J97;
realtype U[97],C,CD,CM;
realtype gset;
long iset;
};
} // namespace math
} // namespace mmdb
#endif
|